]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
UBI: simplify image sequence test
authorRichard Genoud <richard.genoud@gmail.com>
Sat, 28 Sep 2013 13:55:14 +0000 (15:55 +0200)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Thu, 3 Oct 2013 16:42:50 +0000 (19:42 +0300)
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@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
drivers/mtd/ubi/attach.c

index 03b32b05ab1564982b114bb57c46cd5de214151a..33bb1f2b63e4f323f0c0c9494b12a1ce3e46d1e2 100644 (file)
@@ -900,10 +900,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);