* [PATCH v2] mtd: rawnand: abort BBT creation on scan failure
@ 2026-11-18 17:37 James Hilliard
0 siblings, 0 replies; only message in thread
From: James Hilliard @ 2026-11-18 17:37 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Thomas Gleixner, Artem B. Bityuckiy
Cc: linux-mtd, linux-kernel, James Hilliard
A non-ECC error reading a factory bad block marker from OOB stops the
scan. check_create() ignores the error and can write the partial table
to flash as both the primary and the mirror. Both copies then list
unscanned factory-bad blocks as good.
Return the scan error before setting the table versions or writing
either copy.
Fixes: eeada24da8bd ("[MTD] NAND: Read only OOB bytes during bad block scan")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
Changes in v2:
- Explain how a partial scan can record bad blocks as good on flash.
- Link to v1: https://patch.msgid.link/20261103-submit-rawnand-bbt-scan-error-v1-v1-1-0bef8334198c@gmail.com
---
drivers/mtd/nand/raw/nand_bbt.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c
index 93f162805f31..3ca1d7fe573f 100644
--- a/drivers/mtd/nand/raw/nand_bbt.c
+++ b/drivers/mtd/nand/raw/nand_bbt.c
@@ -1006,8 +1006,11 @@ static int check_create(struct nand_chip *this, uint8_t *buf,
continue;
/* Create the table in memory by scanning the chip(s) */
- if (!(this->bbt_options & NAND_BBT_CREATE_EMPTY))
- create_bbt(this, buf, bd, chipsel);
+ if (!(this->bbt_options & NAND_BBT_CREATE_EMPTY)) {
+ res = create_bbt(this, buf, bd, chipsel);
+ if (res)
+ return res;
+ }
td->version[i] = 1;
if (md)
---
base-commit: 292f737382d3913d0d9addf220b7170fedd7a04f
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
change-id: 20261103-submit-rawnand-bbt-scan-error-v1-1183d881e5b2
Best regards,
--
James Hilliard <james.hilliard1@gmail.com>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-18 17:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 17:37 [PATCH v2] mtd: rawnand: abort BBT creation on scan failure James Hilliard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®