[PATCH] mtd: spinand: winbond: Clarify factory BBM offset in OOB layout

Zunyi Hu roberhu001 at 163.com
Fri Jun 12 16:41:21 CEST 2026


The Winbond OOB layout function offsets the region by 2 bytes. Add a
brief comment to explicitly document that these 2 bytes are reserved
for the factory Bad Block Marker (BBM).

This eliminates the "magic number" and improves code readability,
preventing future accidental overwrites of the BBM area.

Signed-off-by: Zunyi Hu <roberhu001 at 163.com>
---
 drivers/mtd/nand/spi/winbond.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
index a89aaec516b..01de6540f0d 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -110,7 +110,7 @@ static int w25m02gv_ooblayout_free(struct mtd_info *mtd, int section,
 	if (section > 3)
 		return -ERANGE;
 
-	region->offset = (16 * section) + 2;
+	region->offset = (16 * section) + 2; /* bytes 0-1 per section: factory BBM */
 	region->length = 6;
 
 	return 0;
-- 
2.17.1



More information about the U-Boot mailing list