]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mtd: rawnand: brcmnand: Fix BCH ECC layout for large page NAND parts
authorKamal Dasu <kdasu.kdev@gmail.com>
Wed, 1 May 2019 19:22:14 +0000 (15:22 -0400)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 27 Jun 2019 18:05:24 +0000 (20:05 +0200)
The way oobregion->offset is derived for large page NAND parts is
wrong, fixes it.

Fixes: ef5eeea6e911 ("mtd: nand: brcm: switch to mtd_ooblayout_ops")
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/brcmnand/brcmnand.c

index 873527753f52fc9da5224c6cc317cc9dd730b90f..f368d1cb89f492788a1a029d4017489b92ecf479 100644 (file)
@@ -931,7 +931,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;