[PATCH 7/9] UBI: simplify image sequence test
Sascha Hauer
s.hauer at pengutronix.de
Tue Jan 7 05:05:33 EST 2014
From: Richard Genoud <richard.genoud at gmail.com>
The test:
if (!a && b)
a = b;
can be symplified in:
if (!a)
a = b;
And there's no need to test if ubi->image_seq is not null, because if it is,
it is set to image_seq.
So, we just test if image_seq is not null.
Signed-off-by: Richard Genoud <richard.genoud at gmail.com>
Signed-off-by: Richard Weinberger <richard at nod.at>
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/mtd/ubi/attach.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
index 8c5c8c3..cb2d041 100644
--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -893,10 +893,9 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
* number.
*/
image_seq = be32_to_cpu(ech->image_seq);
- if (!ubi->image_seq && image_seq)
+ if (!ubi->image_seq)
ubi->image_seq = image_seq;
- if (ubi->image_seq && image_seq &&
- ubi->image_seq != image_seq) {
+ if (image_seq && ubi->image_seq != image_seq) {
ubi_err("bad image sequence number %d in PEB %d, expected %d",
image_seq, pnum, ubi->image_seq);
ubi_dump_ec_hdr(ech);
--
1.8.5.2
More information about the barebox
mailing list