* [PATCH] imx-bbu-nand-fcb: Mark block as bad when erasing it fails
@ 2019-09-25 6:49 Sascha Hauer
0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2019-09-25 6:49 UTC (permalink / raw)
To: Barebox List
When a block cannot be erased it must be marked as bad. Previously we
accidently ignored the erase failure and the the code just wrote the
firmware into that block which resulted in boot failure.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/imx-bbu-nand-fcb.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index bb6dd1d4e9..aa3f733912 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -626,8 +626,15 @@ static int imx_bbu_write_firmware(struct mtd_info *mtd, unsigned num, void *buf,
continue;
ret = mtd_peb_erase(mtd, block + i);
- if (ret && ret != -EIO)
+ if (ret == -EIO) {
+ newbadblock = 1;
+
+ ret = mtd_peb_mark_bad(mtd, block + i);
+ if (ret)
+ return ret;
+ } else if (ret) {
return ret;
+ }
}
while (len > 0) {
--
2.23.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-09-25 6:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-25 6:49 [PATCH] imx-bbu-nand-fcb: Mark block as bad when erasing it fails Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox