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

Reply via email to