Skip to content

Commit 55b80c4

Browse files
rgenouddedekind
authored andcommitted
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>
1 parent c22301a commit 55b80c4

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎drivers/mtd/ubi/attach.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -900,10 +900,9 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
900900
* number.
901901
*/
902902
image_seq = be32_to_cpu(ech->image_seq);
903-
if (!ubi->image_seq && image_seq)
903+
if (!ubi->image_seq)
904904
ubi->image_seq = image_seq;
905-
if (ubi->image_seq && image_seq &&
906-
ubi->image_seq != image_seq) {
905+
if (image_seq && ubi->image_seq != image_seq) {
907906
ubi_err("bad image sequence number %d in PEB %d, expected %d",
908907
image_seq, pnum, ubi->image_seq);
909908
ubi_dump_ec_hdr(ech);

0 commit comments

Comments
 (0)