[PATCH v2 2/3] mtd: nand: omap: fix ecclayout->oobfree->length

Pekon Gupta pekon at ti.com
Fri Feb 14 12:01:47 EST 2014


ECC layout of some ecc-schemes expect a 'reserve-marker' as specific
byte-position in OOB. But current calculation of oobfree->length does not
consider that for all ecc-schemes.
But in general, for all ecc-schems, OOB bytes from oobfree->offset till end of
OOB region are unused. So this patch fixes oobfree->length calculation.

Signed-off-by: Pekon Gupta <pekon at ti.com>
---
 drivers/mtd/nand/omap2.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 874fd9d..433e58a 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1977,9 +1977,8 @@ static int omap_nand_probe(struct platform_device *pdev)
 		goto return_error;
 	}
 
-	/* populate remaining ECC layout data */
-	ecclayout->oobfree->length = mtd->oobsize - (BADBLOCK_MARKER_LENGTH +
-							ecclayout->eccbytes);
+	/* all OOB bytes from oobfree->offset till end off OOB are free */
+	ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset;
 	for (i = 1; i < ecclayout->eccbytes; i++)
 		ecclayout->eccpos[i] = ecclayout->eccpos[0] + i;
 	/* check if NAND device's OOB is enough to store ECC signatures */
-- 
1.8.5.1.163.gd7aced9




More information about the linux-mtd mailing list