diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-09-25 08:45:46 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-09-25 08:49:37 +0200 |
commit | 1b78b514419823b38d0540d836a49a25e53d575e (patch) | |
tree | 2de1098cccadc68c7450941671fabdfa9091a5a5 /common | |
parent | 7e8ac4b05e049f8e0a1bf6b60d097aa9cef1ac55 (diff) | |
download | barebox-1b78b514419823b38d0540d836a49a25e53d575e.tar.gz barebox-1b78b514419823b38d0540d836a49a25e53d575e.tar.xz |
imx-bbu-nand-fcb: Mark block as bad when erasing it fails
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>
Diffstat (limited to 'common')
-rw-r--r-- | common/imx-bbu-nand-fcb.c | 9 |
1 files changed, 8 insertions, 1 deletions
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) { |