aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-10-20 04:51:21 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-10-21 04:20:37 -0400
commitdf3fca4cdddfa6e1f51b65214d4342660649bd1f (patch)
tree13389da659d8d2235f8a56f7e263f11bced19fc6 /drivers/mtd/ubi
parentfb22b59b2c38054cc847f6acc5c46daa26dc6dd3 (diff)
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 <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r--drivers/mtd/ubi/scan.c7
1 files changed, 5 insertions, 2 deletions
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,
784 ubi_dbg_print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, 784 ubi_dbg_print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1,
785 ubi->peb_buf1, ubi->leb_size, 1); 785 ubi->peb_buf1, ubi->leb_size, 1);
786 mutex_unlock(&ubi->buf_mutex); 786 mutex_unlock(&ubi->buf_mutex);
787 return -EINVAL; 787 return 1;
788} 788}
789 789
790/** 790/**
@@ -936,7 +936,10 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
936 * have to check what is in the data area. 936 * have to check what is in the data area.
937 */ 937 */
938 err = check_data_ff(ubi, vidh, pnum); 938 err = check_data_ff(ubi, vidh, pnum);
939 if (!err) 939
940 if (err < 0)
941 return err;
942 else if (!err)
940 /* This corruption is caused by a power cut */ 943 /* This corruption is caused by a power cut */
941 err = add_to_list(si, pnum, ec, 1, &si->erase); 944 err = add_to_list(si, pnum, ec, 1, &si->erase);
942 else 945 else