diff options
author | Richard Genoud <richard.genoud@gmail.com> | 2013-09-28 09:55:14 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2013-10-03 12:42:50 -0400 |
commit | 55b80c409a1368b8dff3c78943101bccb0ea3aa1 (patch) | |
tree | a6cadd8f975bba008a5c05bd19c52411f36cf0e4 | |
parent | c22301ad4fa0f4cf71e9c877d072e6f07a0bf682 (diff) |
UBI: simplify image sequence test
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>
-rw-r--r-- | drivers/mtd/ubi/attach.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c index 03b32b05ab15..33bb1f2b63e4 100644 --- a/drivers/mtd/ubi/attach.c +++ b/drivers/mtd/ubi/attach.c | |||
@@ -900,10 +900,9 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, | |||
900 | * number. | 900 | * number. |
901 | */ | 901 | */ |
902 | image_seq = be32_to_cpu(ech->image_seq); | 902 | image_seq = be32_to_cpu(ech->image_seq); |
903 | if (!ubi->image_seq && image_seq) | 903 | if (!ubi->image_seq) |
904 | ubi->image_seq = image_seq; | 904 | ubi->image_seq = image_seq; |
905 | if (ubi->image_seq && image_seq && | 905 | if (image_seq && ubi->image_seq != image_seq) { |
906 | ubi->image_seq != image_seq) { | ||
907 | ubi_err("bad image sequence number %d in PEB %d, expected %d", | 906 | ubi_err("bad image sequence number %d in PEB %d, expected %d", |
908 | image_seq, pnum, ubi->image_seq); | 907 | image_seq, pnum, ubi->image_seq); |
909 | ubi_dump_ec_hdr(ech); | 908 | ubi_dump_ec_hdr(ech); |