]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mtd: nand: sunxi: fix the NFC_ECC_ERR_CNT() macro
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Fri, 4 Mar 2016 16:25:08 +0000 (17:25 +0100)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 19 Apr 2016 20:05:41 +0000 (22:05 +0200)
NFC_ECC_ERR_CNT() is not taking into account the case when the NAND chip
contains more than 4 ECC blocks (NANDs with 4kB+ pages).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/sunxi_nand.c

index 4dcc0e42e0effba169cb2e1c35378881cb2352fb..4cb5c6f866ff5daf2fcf51e2b6f29db981195bf7 100644 (file)
 /* define bit use in NFC_ECC_ST */
 #define NFC_ECC_ERR(x)         BIT(x)
 #define NFC_ECC_PAT_FOUND(x)   BIT(x + 16)
-#define NFC_ECC_ERR_CNT(b, x)  (((x) >> ((b) * 8)) & 0xff)
+#define NFC_ECC_ERR_CNT(b, x)  (((x) >> (((b) % 4) * 8)) & 0xff)
 
 #define NFC_DEFAULT_TIMEOUT_MS 1000