Skip to contentSkip to conversation

mtd: spinand: winbond: Clarify factory BBM offset in OOB layout

PATCH In review Zunyi Hu 2 participants 2 messages Jun 12 – Oct 24

Subsystems (2)
lore
Share & tools
lore

Zunyi Hu

author
#0 lore raw

PATCH 1/1 mtd: spinand: winbond: Clarify factory BBM offset in OOB layout

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.

---
 drivers/mtd/nand/spi/winbond.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/spi/winbond.c +1 -1
index a89aaec516b..01de6540f0d 100644
@@ -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;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 8 lines · Zunyi Hu

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.

[...]

Applied to u-boot/main, thanks!

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

      commit: 8649a54d301a4d0ac526324c7a7ad2574939ff27
Signature · 1 line
Tom