diff options
Diffstat (limited to 'drivers/mtd/ubi/attach.c')
-rw-r--r-- | drivers/mtd/ubi/attach.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c index bd27cbbb4066..f7adf53e4f45 100644 --- a/drivers/mtd/ubi/attach.c +++ b/drivers/mtd/ubi/attach.c | |||
@@ -79,7 +79,7 @@ | |||
79 | * NAND), it is probably a PEB which was being erased when power cut | 79 | * NAND), it is probably a PEB which was being erased when power cut |
80 | * happened, so this is corruption type 1. However, this is just a guess, | 80 | * happened, so this is corruption type 1. However, this is just a guess, |
81 | * which might be wrong. | 81 | * which might be wrong. |
82 | * o Otherwise this it corruption type 2. | 82 | * o Otherwise this is corruption type 2. |
83 | */ | 83 | */ |
84 | 84 | ||
85 | #include <linux/err.h> | 85 | #include <linux/err.h> |
@@ -378,8 +378,8 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, | |||
378 | if (err == UBI_IO_BITFLIPS) | 378 | if (err == UBI_IO_BITFLIPS) |
379 | bitflips = 1; | 379 | bitflips = 1; |
380 | else { | 380 | else { |
381 | ubi_err("VID of PEB %d header is bad, but it " | 381 | ubi_err("VID of PEB %d header is bad, but it was OK earlier, err %d", |
382 | "was OK earlier, err %d", pnum, err); | 382 | pnum, err); |
383 | if (err > 0) | 383 | if (err > 0) |
384 | err = -EIO; | 384 | err = -EIO; |
385 | 385 | ||
@@ -790,12 +790,12 @@ static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr, | |||
790 | if (ubi_check_pattern(ubi->peb_buf, 0xFF, ubi->leb_size)) | 790 | if (ubi_check_pattern(ubi->peb_buf, 0xFF, ubi->leb_size)) |
791 | goto out_unlock; | 791 | goto out_unlock; |
792 | 792 | ||
793 | ubi_err("PEB %d contains corrupted VID header, and the data does not " | 793 | ubi_err("PEB %d contains corrupted VID header, and the data does not contain all 0xFF", |
794 | "contain all 0xFF, this may be a non-UBI PEB or a severe VID " | 794 | pnum); |
795 | "header corruption which requires manual inspection", pnum); | 795 | ubi_err("this may be a non-UBI PEB or a severe VID header corruption which requires manual inspection"); |
796 | ubi_dump_vid_hdr(vid_hdr); | 796 | ubi_dump_vid_hdr(vid_hdr); |
797 | dbg_msg("hexdump of PEB %d offset %d, length %d", | 797 | pr_err("hexdump of PEB %d offset %d, length %d", |
798 | pnum, ubi->leb_start, ubi->leb_size); | 798 | pnum, ubi->leb_start, ubi->leb_size); |
799 | ubi_dbg_print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, | 799 | ubi_dbg_print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, |
800 | ubi->peb_buf, ubi->leb_size, 1); | 800 | ubi->peb_buf, ubi->leb_size, 1); |
801 | err = 1; | 801 | err = 1; |
@@ -907,8 +907,8 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, | |||
907 | ubi->image_seq = image_seq; | 907 | ubi->image_seq = image_seq; |
908 | if (ubi->image_seq && image_seq && | 908 | if (ubi->image_seq && image_seq && |
909 | ubi->image_seq != image_seq) { | 909 | ubi->image_seq != image_seq) { |
910 | ubi_err("bad image sequence number %d in PEB %d, " | 910 | ubi_err("bad image sequence number %d in PEB %d, expected %d", |
911 | "expected %d", image_seq, pnum, ubi->image_seq); | 911 | image_seq, pnum, ubi->image_seq); |
912 | ubi_dump_ec_hdr(ech); | 912 | ubi_dump_ec_hdr(ech); |
913 | return -EINVAL; | 913 | return -EINVAL; |
914 | } | 914 | } |
@@ -975,7 +975,7 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, | |||
975 | return err; | 975 | return err; |
976 | goto adjust_mean_ec; | 976 | goto adjust_mean_ec; |
977 | case UBI_IO_FF: | 977 | case UBI_IO_FF: |
978 | if (ec_err) | 978 | if (ec_err || bitflips) |
979 | err = add_to_list(ai, pnum, UBI_UNKNOWN, | 979 | err = add_to_list(ai, pnum, UBI_UNKNOWN, |
980 | UBI_UNKNOWN, ec, 1, &ai->erase); | 980 | UBI_UNKNOWN, ec, 1, &ai->erase); |
981 | else | 981 | else |
@@ -997,8 +997,8 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, | |||
997 | /* Unsupported internal volume */ | 997 | /* Unsupported internal volume */ |
998 | switch (vidh->compat) { | 998 | switch (vidh->compat) { |
999 | case UBI_COMPAT_DELETE: | 999 | case UBI_COMPAT_DELETE: |
1000 | ubi_msg("\"delete\" compatible internal volume %d:%d" | 1000 | ubi_msg("\"delete\" compatible internal volume %d:%d found, will remove it", |
1001 | " found, will remove it", vol_id, lnum); | 1001 | vol_id, lnum); |
1002 | err = add_to_list(ai, pnum, vol_id, lnum, | 1002 | err = add_to_list(ai, pnum, vol_id, lnum, |
1003 | ec, 1, &ai->erase); | 1003 | ec, 1, &ai->erase); |
1004 | if (err) | 1004 | if (err) |
@@ -1006,15 +1006,14 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, | |||
1006 | return 0; | 1006 | return 0; |
1007 | 1007 | ||
1008 | case UBI_COMPAT_RO: | 1008 | case UBI_COMPAT_RO: |
1009 | ubi_msg("read-only compatible internal volume %d:%d" | 1009 | ubi_msg("read-only compatible internal volume %d:%d found, switch to read-only mode", |
1010 | " found, switch to read-only mode", | ||
1011 | vol_id, lnum); | 1010 | vol_id, lnum); |
1012 | ubi->ro_mode = 1; | 1011 | ubi->ro_mode = 1; |
1013 | break; | 1012 | break; |
1014 | 1013 | ||
1015 | case UBI_COMPAT_PRESERVE: | 1014 | case UBI_COMPAT_PRESERVE: |
1016 | ubi_msg("\"preserve\" compatible internal volume %d:%d" | 1015 | ubi_msg("\"preserve\" compatible internal volume %d:%d found", |
1017 | " found", vol_id, lnum); | 1016 | vol_id, lnum); |
1018 | err = add_to_list(ai, pnum, vol_id, lnum, | 1017 | err = add_to_list(ai, pnum, vol_id, lnum, |
1019 | ec, 0, &ai->alien); | 1018 | ec, 0, &ai->alien); |
1020 | if (err) | 1019 | if (err) |
@@ -1075,10 +1074,10 @@ static int late_analysis(struct ubi_device *ubi, struct ubi_attach_info *ai) | |||
1075 | if (ai->corr_peb_count) { | 1074 | if (ai->corr_peb_count) { |
1076 | ubi_err("%d PEBs are corrupted and preserved", | 1075 | ubi_err("%d PEBs are corrupted and preserved", |
1077 | ai->corr_peb_count); | 1076 | ai->corr_peb_count); |
1078 | printk(KERN_ERR "Corrupted PEBs are:"); | 1077 | pr_err("Corrupted PEBs are:"); |
1079 | list_for_each_entry(aeb, &ai->corr, u.list) | 1078 | list_for_each_entry(aeb, &ai->corr, u.list) |
1080 | printk(KERN_CONT " %d", aeb->pnum); | 1079 | pr_cont(" %d", aeb->pnum); |
1081 | printk(KERN_CONT "\n"); | 1080 | pr_cont("\n"); |
1082 | 1081 | ||
1083 | /* | 1082 | /* |
1084 | * If too many PEBs are corrupted, we refuse attaching, | 1083 | * If too many PEBs are corrupted, we refuse attaching, |
@@ -1112,8 +1111,7 @@ static int late_analysis(struct ubi_device *ubi, struct ubi_attach_info *ai) | |||
1112 | get_random_bytes(&ubi->image_seq, | 1111 | get_random_bytes(&ubi->image_seq, |
1113 | sizeof(ubi->image_seq)); | 1112 | sizeof(ubi->image_seq)); |
1114 | } else { | 1113 | } else { |
1115 | ubi_err("MTD device is not UBI-formatted and possibly " | 1114 | ubi_err("MTD device is not UBI-formatted and possibly contains non-UBI data - refusing it"); |
1116 | "contains non-UBI data - refusing it"); | ||
1117 | return -EINVAL; | 1115 | return -EINVAL; |
1118 | } | 1116 | } |
1119 | 1117 | ||
@@ -1172,7 +1170,7 @@ static struct ubi_attach_info *scan_all(struct ubi_device *ubi) | |||
1172 | goto out_vidh; | 1170 | goto out_vidh; |
1173 | } | 1171 | } |
1174 | 1172 | ||
1175 | dbg_msg("scanning is finished"); | 1173 | ubi_msg("scanning is finished"); |
1176 | 1174 | ||
1177 | /* Calculate mean erase counter */ | 1175 | /* Calculate mean erase counter */ |
1178 | if (ai->ec_count) | 1176 | if (ai->ec_count) |
@@ -1244,7 +1242,7 @@ int ubi_attach(struct ubi_device *ubi) | |||
1244 | ubi->corr_peb_count = ai->corr_peb_count; | 1242 | ubi->corr_peb_count = ai->corr_peb_count; |
1245 | ubi->max_ec = ai->max_ec; | 1243 | ubi->max_ec = ai->max_ec; |
1246 | ubi->mean_ec = ai->mean_ec; | 1244 | ubi->mean_ec = ai->mean_ec; |
1247 | ubi_msg("max. sequence number: %llu", ai->max_sqnum); | 1245 | dbg_gen("max. sequence number: %llu", ai->max_sqnum); |
1248 | 1246 | ||
1249 | err = ubi_read_volume_table(ubi, ai); | 1247 | err = ubi_read_volume_table(ubi, ai); |
1250 | if (err) | 1248 | if (err) |