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@xxxxxxxxxxxxxx> --- 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@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox