diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-04-30 09:50:22 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-06-04 04:30:42 -0400 |
commit | 786d78318586cbdc8aec539fe5a4942490267fef (patch) | |
tree | 3ca3144ce0186dea041782b8a9789caf16d89cbb /drivers/mtd/ubi/io.c | |
parent | 67a3e12b05e055c0415c556a315a3d3eb637e29e (diff) |
UBI: simplify IO error codes
We do not really need 2 separate error codes for indicating bad VID
and bad EC headers (UBI_IO_BAD_EC_HDR, UBI_IO_BAD_VID_HDR), it is
enough to have only one UBI_IO_BAD_HDR return code.
This patch does not introduce any functional change, only some
code simplification.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Tested-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Diffstat (limited to 'drivers/mtd/ubi/io.c')
-rw-r--r-- | drivers/mtd/ubi/io.c | 14 |
1 files changed, 7 insertions, 7 deletions
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 */ |