aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_bbt.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2011-06-28 19:28:58 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 08:02:14 -0400
commit903cd06cd6ece7f9050a3ad5b03e0b76be2882ff (patch)
treea538b351316987ddcef8dd28fb31b9e1bbd7a910 /drivers/mtd/nand/nand_bbt.c
parent51b11e3630672b7ce8793ecf13e5759656edf38a (diff)
mtd: nand: ignore ECC errors for simple BBM scans
Now that nand_do_readoob() may return -EUCLEAN or -EBADMSG on ECC errors, we need to handle the return value specially in some cases. When scanning for simple bad block markers, reacting to an ECC error is not very useful, as we assume that the relevant markers are still non-0xFF for true bad blocks. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
Diffstat (limited to 'drivers/mtd/nand/nand_bbt.c')
-rw-r--r--drivers/mtd/nand/nand_bbt.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index f30807c3a48d..a4fcbf1cbc76 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -312,14 +312,20 @@ static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
312 ops.oobbuf = buf + len; 312 ops.oobbuf = buf + len;
313 ops.datbuf = buf; 313 ops.datbuf = buf;
314 ops.len = len; 314 ops.len = len;
315 return mtd->read_oob(mtd, offs, &ops); 315 res = mtd->read_oob(mtd, offs, &ops);
316
317 /* Ignore ECC errors when checking for BBM */
318 if (res != -EUCLEAN && res != -EBADMSG)
319 return res;
320 return 0;
316 } else { 321 } else {
317 ops.oobbuf = buf + mtd->writesize; 322 ops.oobbuf = buf + mtd->writesize;
318 ops.datbuf = buf; 323 ops.datbuf = buf;
319 ops.len = mtd->writesize; 324 ops.len = mtd->writesize;
320 res = mtd->read_oob(mtd, offs, &ops); 325 res = mtd->read_oob(mtd, offs, &ops);
321 326
322 if (res) 327 /* Ignore ECC errors when checking for BBM */
328 if (res && res != -EUCLEAN && res != -EBADMSG)
323 return res; 329 return res;
324 } 330 }
325 331
@@ -435,7 +441,8 @@ static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd,
435 * byte reads for 16 bit buswidth. 441 * byte reads for 16 bit buswidth.
436 */ 442 */
437 ret = mtd->read_oob(mtd, offs, &ops); 443 ret = mtd->read_oob(mtd, offs, &ops);
438 if (ret) 444 /* Ignore ECC errors when checking for BBM */
445 if (ret && ret != -EUCLEAN && ret != -EBADMSG)
439 return ret; 446 return ret;
440 447
441 if (check_short_pattern(buf, bd)) 448 if (check_short_pattern(buf, bd))