diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/imx-bbu-nand-fcb.c | 5 | ||||
-rw-r--r-- | common/state/backend_bucket_circular.c | 2 | ||||
-rw-r--r-- | common/ubiformat.c | 18 |
3 files changed, 19 insertions, 6 deletions
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c index 6d773b59df..a62e2a2975 100644 --- a/common/imx-bbu-nand-fcb.c +++ b/common/imx-bbu-nand-fcb.c @@ -531,6 +531,9 @@ again: if (ret == -EBADMSG) { ret = mtd_peb_torture(mtd, block); + if (ret == -EIO) + mtd_peb_mark_bad(mtd, block); + if (!ret && retries++ < 3) goto again; } @@ -771,6 +774,8 @@ out: if (ret == -EBADMSG) { ret = mtd_peb_torture(mtd, block); + if (ret == -EIO) + mtd_peb_mark_bad(mtd, block); if (!ret && retries++ < 3) goto again; diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c index 4676730d05..47970b79f3 100644 --- a/common/state/backend_bucket_circular.c +++ b/common/state/backend_bucket_circular.c @@ -95,6 +95,7 @@ static int state_mtd_peb_read(struct state_backend_storage_bucket_circular *circ if (ret == -EBADMSG) { ret = mtd_peb_torture(circ->mtd, circ->eraseblock); if (ret == -EIO) { + mtd_peb_mark_bad(circ->mtd, circ->eraseblock); dev_err(circ->dev, "Tortured eraseblock failed and is marked bad now, PEB %u\n", circ->eraseblock); return -EIO; @@ -132,6 +133,7 @@ static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *cir if (ret == -EBADMSG) { ret = mtd_peb_torture(circ->mtd, circ->eraseblock); if (ret == -EIO) { + mtd_peb_mark_bad(circ->mtd, circ->eraseblock); dev_err(circ->dev, "Tortured eraseblock failed and is marked bad now, PEB %u\n", circ->eraseblock); return -EIO; diff --git a/common/ubiformat.c b/common/ubiformat.c index fe02270b78..4f0df6fd5c 100644 --- a/common/ubiformat.c +++ b/common/ubiformat.c @@ -310,10 +310,13 @@ static int flash_image(struct ubiformat_args *args, struct mtd_info *mtd, goto out_close; err = mtd_peb_torture(mtd, eb); - if (err < 0 && err != -EIO) - goto out_close; - if (err == -EIO && consecutive_bad_check(args, eb)) + if (err == -EIO) { + err = mark_bad(args, mtd, si, eb); + if (err) + goto out_close; + } else if (err) { goto out_close; + } continue; } @@ -426,10 +429,13 @@ static int format(struct ubiformat_args *args, struct mtd_info *mtd, } err = mtd_peb_torture(mtd, eb); - if (err < 0 && err != -EIO) - goto out_free; - if (err == -EIO && consecutive_bad_check(args, eb)) + if (err == -EIO) { + err = mark_bad(args, mtd, si, eb); + if (err) + goto out_free; + } else if (err) { goto out_free; + } continue; |