[U-Boot] [PATCH 2/4] mtd: nand: Don't abort erase operation when a bad block is detected

Stefan Roese sr at denx.de
Mon Aug 6 15:12:51 UTC 2018


It was noticed, that the erase command (mtd erase spi-nand0) aborts upon
the first bad block. With this change, bad blocks are now skipped and
the erase operation will continue.

Signed-off-by: Stefan Roese <sr at denx.de>
Cc: Miquel Raynal <miquel.raynal at bootlin.com>
Cc: Boris Brezillon <boris.brezillon at bootlin.com>
Cc: Jagan Teki <jagan at openedev.com>
---
 drivers/mtd/nand/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c
index 0b793695cc..888f765b90 100644
--- a/drivers/mtd/nand/core.c
+++ b/drivers/mtd/nand/core.c
@@ -162,7 +162,7 @@ int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo)
 	nanddev_offs_to_pos(nand, einfo->addr + einfo->len - 1, &last);
 	while (nanddev_pos_cmp(&pos, &last) <= 0) {
 		ret = nanddev_erase(nand, &pos);
-		if (ret) {
+		if (ret && ret != -EIO) {
 			einfo->fail_addr = nanddev_pos_to_offs(nand, &pos);
 
 			return ret;
-- 
2.18.0



More information about the U-Boot mailing list