From: Pekon Gupta Date: Mon, 17 Feb 2014 07:41:25 +0000 (+0530) Subject: mtd: nand: omap: fix ecclayout->oobfree->length X-Git-Tag: v3.13.6~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f648ea81458f23fc6a0d0ed2e9a85b976a76c32;p=thirdparty%2Fkernel%2Fstable.git mtd: nand: omap: fix ecclayout->oobfree->length commit bb38eefb6858ce16b34716145b9597a5680aa54c upstream. This patch excludes reserved-marker byte-position from oobfree->length calculation. Thus all bytes from oobfree->offset till end of OOB are free. Signed-off-by: Pekon Gupta Signed-off-by: Brian Norris Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 6d6445222f1b0..2365b5a3a357d 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -2000,9 +2000,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; /* check if NAND device's OOB is enough to store ECC signatures */ if (mtd->oobsize < (ecclayout->eccbytes + BADBLOCK_MARKER_LENGTH)) { pr_err("not enough OOB bytes required = %d, available=%d\n",