提交 903cd06c 编写于 作者: B Brian Norris 提交者: Artem Bityutskiy

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: NBrian Norris <computersforpeace@gmail.com>
Signed-off-by: NArtem Bityutskiy <dedekind1@gmail.com>
上级 51b11e36
...@@ -312,14 +312,20 @@ static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs, ...@@ -312,14 +312,20 @@ static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
ops.oobbuf = buf + len; ops.oobbuf = buf + len;
ops.datbuf = buf; ops.datbuf = buf;
ops.len = len; ops.len = len;
return mtd->read_oob(mtd, offs, &ops); res = mtd->read_oob(mtd, offs, &ops);
/* Ignore ECC errors when checking for BBM */
if (res != -EUCLEAN && res != -EBADMSG)
return res;
return 0;
} else { } else {
ops.oobbuf = buf + mtd->writesize; ops.oobbuf = buf + mtd->writesize;
ops.datbuf = buf; ops.datbuf = buf;
ops.len = mtd->writesize; ops.len = mtd->writesize;
res = mtd->read_oob(mtd, offs, &ops); res = mtd->read_oob(mtd, offs, &ops);
if (res) /* Ignore ECC errors when checking for BBM */
if (res && res != -EUCLEAN && res != -EBADMSG)
return res; return res;
} }
...@@ -435,7 +441,8 @@ static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd, ...@@ -435,7 +441,8 @@ static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd,
* byte reads for 16 bit buswidth. * byte reads for 16 bit buswidth.
*/ */
ret = mtd->read_oob(mtd, offs, &ops); ret = mtd->read_oob(mtd, offs, &ops);
if (ret) /* Ignore ECC errors when checking for BBM */
if (ret && ret != -EUCLEAN && ret != -EBADMSG)
return ret; return ret;
if (check_short_pattern(buf, bd)) if (check_short_pattern(buf, bd))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册