Skip to contentSkip to conversation

mtd: rawnand: brcmnand: fix bch ecc layout for large page nand

PATCH Superseded Kamal Dasu 3 participants 3 messages Apr 26, 2019 – May 1, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kamal Dasu

author
#0 lore raw

PATCH 1/1 mtd: rawnand: brcmnand: fix bch ecc layout for large page nand

The oobregion->offset for large page nand parts was wrong, change fixes this error in calculation.

---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1 -1
index 482c6f0..3eefea7 100644
@@ -939,7 +939,7 @@ static int brcmnand_bch_ooblayout_ecc(struct mtd_info *mtd, int section,
 	if (section >= sectors)
 		return -ERANGE;
 
-	oobregion->offset = (section * (sas + 1)) - chip->ecc.bytes;
+	oobregion->offset = ((section + 1) * sas) - chip->ecc.bytes;
 	oobregion->length = chip->ecc.bytes;
 
 	return 0;
Signature · 1 line
1.9.0.138.g2de3478
#1 lore raw
Quoted 2 lines · Kamal Dasu

The oobregion->offset for large page nand parts was wrong, change fixes this error in calculation.

Should this have a Fixes tag so this can be backported to stable trees seemingly automatically? Thanks!

Quoted 20 lines
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1 -1
index 482c6f0..3eefea7 100644
@@ -939,7 +939,7 @@ static int brcmnand_bch_ooblayout_ecc(struct mtd_info *mtd, int section,
 	if (section >= sectors)
 		return -ERANGE;
 
-	oobregion->offset = (section * (sas + 1)) - chip->ecc.bytes;
+	oobregion->offset = ((section + 1) * sas) - chip->ecc.bytes;
 	oobregion->length = chip->ecc.bytes;
 
 	return 0;
Signature · 1 line
Florian
maintainer
#2 lore raw
Quoted 8 lines · Florian Fainelli
Quoted 2 lines · Kamal Dasu

The oobregion->offset for large page nand parts was wrong, change fixes this error in calculation.

Should this have a Fixes tag so this can be backported to stable trees seemingly automatically? Thanks!

The brcmnand files got moved, however should have the fixes tag, will send V2 patch.

Quoted 24 lines
Quoted 12 lines
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +0 -0
index 482c6f0..3eefea7 100644

drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_bch_ooblayout_ecc(struct mtd_info *mtd, int section, · line 945

Quoted 8 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1 -1
@@ -939,7 +939,7 @@ static int brcmnand_bch_ooblayout_ecc(struct mtd_info *mtd, int section,
      if (section >= sectors)
              return -ERANGE;
 
-     oobregion->offset = (section * (sas + 1)) - chip->ecc.bytes;
+     oobregion->offset = ((section + 1) * sas) - chip->ecc.bytes;
      oobregion->length = chip->ecc.bytes;
 
      return 0;

--
Florian