summaryrefslogtreecommitdiff
path: root/common/imx-bbu-nand-fcb.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-07-15 15:28:55 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-07-16 09:04:40 +0200
commit3b68dbcbfce830bdf91f50943e5ee41463717abf (patch)
tree230009208fe715a6e89365645f1a9fc0ef508cf7 /common/imx-bbu-nand-fcb.c
parent4c216abb0cf5da6f896298fa875cd7bb80dc76b9 (diff)
downloadbarebox-3b68dbcbfce830bdf91f50943e5ee41463717abf.tar.gz
mtd: peb: Do not mark as bad in mtd_peb_torture()
Both the Kernel and mtd-utils have peb torture functions and both do not mark the block as bad automatically. Instead, the caller must mark the block as bad when -EIO is returned from the torture function. Do the same in barebox. This is necessary as the UBI code otherwise may mark a block as bad twice: Once indirectly in mtd_peb_torture() and then directly afterwards. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/imx-bbu-nand-fcb.c')
-rw-r--r--common/imx-bbu-nand-fcb.c5
1 files changed, 5 insertions, 0 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;