aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/ubi/eba.c4
-rw-r--r--drivers/mtd/ubi/io.c14
-rw-r--r--drivers/mtd/ubi/scan.c4
-rw-r--r--drivers/mtd/ubi/ubi.h7
4 files changed, 13 insertions, 16 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 9f87c99189a9..8e8226744320 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -418,7 +418,7 @@ retry:
418 * may try to recover data. FIXME: but this is 418 * may try to recover data. FIXME: but this is
419 * not implemented. 419 * not implemented.
420 */ 420 */
421 if (err == UBI_IO_BAD_VID_HDR) { 421 if (err == UBI_IO_BAD_HDR) {
422 ubi_warn("corrupted VID header at PEB " 422 ubi_warn("corrupted VID header at PEB "
423 "%d, LEB %d:%d", pnum, vol_id, 423 "%d, LEB %d:%d", pnum, vol_id,
424 lnum); 424 lnum);
@@ -961,7 +961,7 @@ write_error:
961 */ 961 */
962static int is_error_sane(int err) 962static int is_error_sane(int err)
963{ 963{
964 if (err == -EIO || err == -ENOMEM || err == UBI_IO_BAD_VID_HDR || 964 if (err == -EIO || err == -ENOMEM || err == UBI_IO_BAD_HDR ||
965 err == -ETIMEDOUT) 965 err == -ETIMEDOUT)
966 return 0; 966 return 0;
967 return 1; 967 return 1;
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 4b979e34b159..02b19327dcc4 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -515,7 +515,7 @@ static int nor_erase_prepare(struct ubi_device *ubi, int pnum)
515 * In this case we probably anyway have garbage in this PEB. 515 * In this case we probably anyway have garbage in this PEB.
516 */ 516 */
517 err1 = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0); 517 err1 = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0);
518 if (err1 == UBI_IO_BAD_VID_HDR) 518 if (err1 == UBI_IO_BAD_HDR)
519 /* 519 /*
520 * The VID header is corrupted, so we can safely erase this 520 * The VID header is corrupted, so we can safely erase this
521 * PEB and not afraid that it will be treated as a valid PEB in 521 * PEB and not afraid that it will be treated as a valid PEB in
@@ -709,7 +709,7 @@ bad:
709 * o %UBI_IO_BITFLIPS if the CRC is correct, but bit-flips were detected 709 * o %UBI_IO_BITFLIPS if the CRC is correct, but bit-flips were detected
710 * and corrected by the flash driver; this is harmless but may indicate that 710 * and corrected by the flash driver; this is harmless but may indicate that
711 * this eraseblock may become bad soon (but may be not); 711 * this eraseblock may become bad soon (but may be not);
712 * o %UBI_IO_BAD_EC_HDR if the erase counter header is corrupted (a CRC error); 712 * o %UBI_IO_BAD_HDR if the erase counter header is corrupted (a CRC error);
713 * o %UBI_IO_PEB_EMPTY if the physical eraseblock is empty; 713 * o %UBI_IO_PEB_EMPTY if the physical eraseblock is empty;
714 * o a negative error code in case of failure. 714 * o a negative error code in case of failure.
715 */ 715 */
@@ -774,7 +774,7 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,
774 } else if (UBI_IO_DEBUG) 774 } else if (UBI_IO_DEBUG)
775 dbg_msg("bad magic number at PEB %d: %08x instead of " 775 dbg_msg("bad magic number at PEB %d: %08x instead of "
776 "%08x", pnum, magic, UBI_EC_HDR_MAGIC); 776 "%08x", pnum, magic, UBI_EC_HDR_MAGIC);
777 return UBI_IO_BAD_EC_HDR; 777 return UBI_IO_BAD_HDR;
778 } 778 }
779 779
780 crc = crc32(UBI_CRC32_INIT, ec_hdr, UBI_EC_HDR_SIZE_CRC); 780 crc = crc32(UBI_CRC32_INIT, ec_hdr, UBI_EC_HDR_SIZE_CRC);
@@ -788,7 +788,7 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,
788 } else if (UBI_IO_DEBUG) 788 } else if (UBI_IO_DEBUG)
789 dbg_msg("bad EC header CRC at PEB %d, calculated " 789 dbg_msg("bad EC header CRC at PEB %d, calculated "
790 "%#08x, read %#08x", pnum, crc, hdr_crc); 790 "%#08x, read %#08x", pnum, crc, hdr_crc);
791 return UBI_IO_BAD_EC_HDR; 791 return UBI_IO_BAD_HDR;
792 } 792 }
793 793
794 /* And of course validate what has just been read from the media */ 794 /* And of course validate what has just been read from the media */
@@ -977,7 +977,7 @@ bad:
977 * o %UBI_IO_BITFLIPS if the CRC is correct, but bit-flips were detected 977 * o %UBI_IO_BITFLIPS if the CRC is correct, but bit-flips were detected
978 * and corrected by the flash driver; this is harmless but may indicate that 978 * and corrected by the flash driver; this is harmless but may indicate that
979 * this eraseblock may become bad soon; 979 * this eraseblock may become bad soon;
980 * o %UBI_IO_BAD_VID_HDR if the volume identifier header is corrupted (a CRC 980 * o %UBI_IO_BAD_HDR if the volume identifier header is corrupted (a CRC
981 * error detected); 981 * error detected);
982 * o %UBI_IO_PEB_FREE if the physical eraseblock is free (i.e., there is no VID 982 * o %UBI_IO_PEB_FREE if the physical eraseblock is free (i.e., there is no VID
983 * header there); 983 * header there);
@@ -1045,7 +1045,7 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
1045 } else if (UBI_IO_DEBUG) 1045 } else if (UBI_IO_DEBUG)
1046 dbg_msg("bad magic number at PEB %d: %08x instead of " 1046 dbg_msg("bad magic number at PEB %d: %08x instead of "
1047 "%08x", pnum, magic, UBI_VID_HDR_MAGIC); 1047 "%08x", pnum, magic, UBI_VID_HDR_MAGIC);
1048 return UBI_IO_BAD_VID_HDR; 1048 return UBI_IO_BAD_HDR;
1049 } 1049 }
1050 1050
1051 crc = crc32(UBI_CRC32_INIT, vid_hdr, UBI_VID_HDR_SIZE_CRC); 1051 crc = crc32(UBI_CRC32_INIT, vid_hdr, UBI_VID_HDR_SIZE_CRC);
@@ -1059,7 +1059,7 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
1059 } else if (UBI_IO_DEBUG) 1059 } else if (UBI_IO_DEBUG)
1060 dbg_msg("bad CRC at PEB %d, calculated %#08x, " 1060 dbg_msg("bad CRC at PEB %d, calculated %#08x, "
1061 "read %#08x", pnum, crc, hdr_crc); 1061 "read %#08x", pnum, crc, hdr_crc);
1062 return UBI_IO_BAD_VID_HDR; 1062 return UBI_IO_BAD_HDR;
1063 } 1063 }
1064 1064
1065 /* Validate the VID header that we have just read */ 1065 /* Validate the VID header that we have just read */
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index aed19f33b8f3..b878a7661f5a 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -745,7 +745,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
745 bitflips = 1; 745 bitflips = 1;
746 else if (err == UBI_IO_PEB_EMPTY) 746 else if (err == UBI_IO_PEB_EMPTY)
747 return add_to_list(si, pnum, UBI_SCAN_UNKNOWN_EC, &si->erase); 747 return add_to_list(si, pnum, UBI_SCAN_UNKNOWN_EC, &si->erase);
748 else if (err == UBI_IO_BAD_EC_HDR) { 748 else if (err == UBI_IO_BAD_HDR) {
749 /* 749 /*
750 * We have to also look at the VID header, possibly it is not 750 * We have to also look at the VID header, possibly it is not
751 * corrupted. Set %bitflips flag in order to make this PEB be 751 * corrupted. Set %bitflips flag in order to make this PEB be
@@ -813,7 +813,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
813 return err; 813 return err;
814 else if (err == UBI_IO_BITFLIPS) 814 else if (err == UBI_IO_BITFLIPS)
815 bitflips = 1; 815 bitflips = 1;
816 else if (err == UBI_IO_BAD_VID_HDR || 816 else if (err == UBI_IO_BAD_HDR ||
817 (err == UBI_IO_PEB_FREE && ec_corr)) { 817 (err == UBI_IO_PEB_FREE && ec_corr)) {
818 /* VID header is corrupted */ 818 /* VID header is corrupted */
819 err = add_to_list(si, pnum, ec, &si->corr); 819 err = add_to_list(si, pnum, ec, &si->corr);
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index a637f0283add..539b3f6c7a56 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -89,16 +89,13 @@
89 * %0xFF bytes 89 * %0xFF bytes
90 * UBI_IO_PEB_FREE: the physical eraseblock is free, i.e. it contains only a 90 * UBI_IO_PEB_FREE: the physical eraseblock is free, i.e. it contains only a
91 * valid erase counter header, and the rest are %0xFF bytes 91 * valid erase counter header, and the rest are %0xFF bytes
92 * UBI_IO_BAD_EC_HDR: the erase counter header is corrupted (bad magic or CRC) 92 * UBI_IO_BAD_HDR: the EC or VID header is corrupted (bad magic or CRC)
93 * UBI_IO_BAD_VID_HDR: the volume identifier header is corrupted (bad magic or
94 * CRC)
95 * UBI_IO_BITFLIPS: bit-flips were detected and corrected 93 * UBI_IO_BITFLIPS: bit-flips were detected and corrected
96 */ 94 */
97enum { 95enum {
98 UBI_IO_PEB_EMPTY = 1, 96 UBI_IO_PEB_EMPTY = 1,
99 UBI_IO_PEB_FREE, 97 UBI_IO_PEB_FREE,
100 UBI_IO_BAD_EC_HDR, 98 UBI_IO_BAD_HDR,
101 UBI_IO_BAD_VID_HDR,
102 UBI_IO_BITFLIPS 99 UBI_IO_BITFLIPS
103}; 100};
104 101