atmel_nand: use the definition: PMECC_OOB_RESERVED_BYTES instead magic number
authorJosh Wu <josh.wu@atmel.com>
Mon, 25 Jan 2016 06:06:35 +0000 (14:06 +0800)
committerAndreas Bießmann <andreas.devel@googlemail.com>
Wed, 27 Jan 2016 12:58:59 +0000 (13:58 +0100)
As atmel_nand_ecc.h is sync with v4.1 kernel, which adds the
PMECC_OOB_RESERVED_BYTES. So use it in the driver.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
drivers/mtd/nand/atmel_nand.c

index 852883bfb2e603072f794ef52f9d420c32e79c91..73fd403886a92e18c2e14e5756c8a238b980c833 100644 (file)
@@ -901,7 +901,7 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand,
                        return -EINVAL;
                }
 
-               if (nand->ecc.bytes > mtd->oobsize - 2) {
+               if (nand->ecc.bytes > mtd->oobsize - PMECC_OOB_RESERVED_BYTES) {
                        dev_err(host->dev, "No room for ECC bytes\n");
                        return -EINVAL;
                }