aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2011-09-07 16:13:29 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 09:48:49 -0400
commitafa17de262633603dd65f89e9370f48e56b8c557 (patch)
treed8509ed2d17d4cdd8b569e2c4e12efbab8e8b7e3 /drivers/mtd
parent105513cc4a25522f959788371bd612f987d4d184 (diff)
mtd: nand: do not ignore all ECC errors
There are a few reasons not to ignore ECC errors here. First, mtd->read_oob is being called in raw mode, so there should be no error correction in the first place. Second, if we change this such that there *is* error correction in this function, then we will want to pass the error message upward. In fact, the code I introduced to "ignore ECC errors" would have been better if it had just placed this test down in `scan_block_full()' in the first place. We would like to ignore ECC errors when we are simply checking for bad block markers (e.g., factory marked), but we may not want to ignore ECC errors when scanning OOB for a flash-based BBT pattern (in `scan_read_raw()'; note that the return codes from `scan_read_raw()' are not actually handled yet). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_bbt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index cbf9b695c6f2..fcfaf06beaaf 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -313,8 +313,7 @@ static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
313 313
314 res = mtd->read_oob(mtd, offs, &ops); 314 res = mtd->read_oob(mtd, offs, &ops);
315 315
316 /* Ignore ECC errors when checking for BBM */ 316 if (res)
317 if (res && res != -EUCLEAN && res != -EBADMSG)
318 return res; 317 return res;
319 318
320 buf += mtd->oobsize + mtd->writesize; 319 buf += mtd->oobsize + mtd->writesize;
@@ -400,7 +399,8 @@ static int scan_block_full(struct mtd_info *mtd, struct nand_bbt_descr *bd,
400 int ret, j; 399 int ret, j;
401 400
402 ret = scan_read_raw_oob(mtd, buf, offs, readlen); 401 ret = scan_read_raw_oob(mtd, buf, offs, readlen);
403 if (ret) 402 /* Ignore ECC errors when checking for BBM */
403 if (ret && ret != -EUCLEAN && ret != -EBADMSG)
404 return ret; 404 return ret;
405 405
406 for (j = 0; j < len; j++, buf += scanlen) { 406 for (j = 0; j < len; j++, buf += scanlen) {