From df3fca4cdddfa6e1f51b65214d4342660649bd1f Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Wed, 20 Oct 2010 11:51:21 +0300 Subject: UBI: fix check_data_ff return code When the data does not contain all 0xFF bytes, 'check_data_ff()' should return 1, not -EINVAL; Also, the caller ('process_eb()') should not add the PEB to the "corrupted" list if there was a read error. Signed-off-by: Artem Bityutskiy --- drivers/mtd/ubi/scan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index 2fbb571b9828..e7b800b1d072 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c @@ -784,7 +784,7 @@ static int check_data_ff(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr, ubi_dbg_print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, ubi->peb_buf1, ubi->leb_size, 1); mutex_unlock(&ubi->buf_mutex); - return -EINVAL; + return 1; } /** @@ -936,7 +936,10 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, * have to check what is in the data area. */ err = check_data_ff(ubi, vidh, pnum); - if (!err) + + if (err < 0) + return err; + else if (!err) /* This corruption is caused by a power cut */ err = add_to_list(si, pnum, ec, 1, &si->erase); else -- cgit v1.2.2