[PATCH 2/3] mtd: nand: omap_gpmc: fix BCH16 OOB free length

Wagner Popov dos Santos <[email protected]>
Newsgroups gmane.comp.boot-loaders.u-boot.general,gmane.comp.boot-loaders.u-boot
Message-ID <9c05b4593bd0d002bcf8634c85d0c14fbc403d43.1787320113.git.wpopov@gmail.com>
The BCH16 ECC layout calculates oobfree.length using nand->ecc.bytes
instead of the total number of ECC bytes in the page.

Use ecclayout->eccbytes so that the available OOB length accounts for
all ECC steps.

Signed-off-by: Wagner Popov dos Santos <[email protected]>
---
 drivers/mtd/nand/raw/omap_gpmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/omap_gpmc.c b/drivers/mtd/nand/raw/omap_gpmc.c
index 0fbca6b9f27..b3c046f2abc 100644
--- a/drivers/mtd/nand/raw/omap_gpmc.c
+++ b/drivers/mtd/nand/raw/omap_gpmc.c
@@ -999,7 +999,7 @@ static int omap_select_ecc_scheme(struct nand_chip *nand,
 		for (i = 0; i < ecclayout->eccbytes; i++)
 			ecclayout->eccpos[i] = i + BADBLOCK_MARKER_LENGTH;
 		ecclayout->oobfree[0].offset = i + BADBLOCK_MARKER_LENGTH;
-		ecclayout->oobfree[0].length = oobsize - nand->ecc.bytes -
+		ecclayout->oobfree[0].length = oobsize - ecclayout->eccbytes -
 						BADBLOCK_MARKER_LENGTH;
 		break;
 #else
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.