diff options
Diffstat (limited to 'drivers/mtd/ubi/scan.c')
-rw-r--r-- | drivers/mtd/ubi/scan.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index b847745394b4..e7161adc419d 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c | |||
@@ -75,9 +75,10 @@ static int add_to_list(struct ubi_scan_info *si, int pnum, int ec, | |||
75 | dbg_bld("add to free: PEB %d, EC %d", pnum, ec); | 75 | dbg_bld("add to free: PEB %d, EC %d", pnum, ec); |
76 | else if (list == &si->erase) | 76 | else if (list == &si->erase) |
77 | dbg_bld("add to erase: PEB %d, EC %d", pnum, ec); | 77 | dbg_bld("add to erase: PEB %d, EC %d", pnum, ec); |
78 | else if (list == &si->corr) | 78 | else if (list == &si->corr) { |
79 | dbg_bld("add to corrupted: PEB %d, EC %d", pnum, ec); | 79 | dbg_bld("add to corrupted: PEB %d, EC %d", pnum, ec); |
80 | else if (list == &si->alien) | 80 | si->corr_count += 1; |
81 | } else if (list == &si->alien) | ||
81 | dbg_bld("add to alien: PEB %d, EC %d", pnum, ec); | 82 | dbg_bld("add to alien: PEB %d, EC %d", pnum, ec); |
82 | else | 83 | else |
83 | BUG(); | 84 | BUG(); |
@@ -864,7 +865,9 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, | |||
864 | } | 865 | } |
865 | } | 866 | } |
866 | 867 | ||
867 | /* Both UBI headers seem to be fine */ | 868 | if (ec_corr) |
869 | ubi_warn("valid VID header but corrupted EC header at PEB %d", | ||
870 | pnum); | ||
868 | err = ubi_scan_add_used(ubi, si, pnum, ec, vidh, bitflips); | 871 | err = ubi_scan_add_used(ubi, si, pnum, ec, vidh, bitflips); |
869 | if (err) | 872 | if (err) |
870 | return err; | 873 | return err; |
@@ -936,6 +939,19 @@ struct ubi_scan_info *ubi_scan(struct ubi_device *ubi) | |||
936 | ubi_msg("empty MTD device detected"); | 939 | ubi_msg("empty MTD device detected"); |
937 | 940 | ||
938 | /* | 941 | /* |
942 | * Few corrupted PEBs are not a problem and may be just a result of | ||
943 | * unclean reboots. However, many of them may indicate some problems | ||
944 | * with the flash HW or driver. Print a warning in this case. | ||
945 | */ | ||
946 | if (si->corr_count >= 8 || si->corr_count >= ubi->peb_count / 4) { | ||
947 | ubi_warn("%d PEBs are corrupted", si->corr_count); | ||
948 | printk(KERN_WARNING "corrupted PEBs are:"); | ||
949 | list_for_each_entry(seb, &si->corr, u.list) | ||
950 | printk(KERN_CONT " %d", seb->pnum); | ||
951 | printk(KERN_CONT "\n"); | ||
952 | } | ||
953 | |||
954 | /* | ||
939 | * In case of unknown erase counter we use the mean erase counter | 955 | * In case of unknown erase counter we use the mean erase counter |
940 | * value. | 956 | * value. |
941 | */ | 957 | */ |