mtd: nand: sunxi: fix the NFC_ECC_ERR_CNT() macro

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon May 23 21:59:10 PDT 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=f8b04746a4ba389d609b5ddcfbf95835c7dfcb31
Commit:     f8b04746a4ba389d609b5ddcfbf95835c7dfcb31
Parent:     ece03cfd5260e0349442dea1d1065f44fbed1ea8
Author:     Boris Brezillon <boris.brezillon at free-electrons.com>
AuthorDate: Fri Mar 4 17:25:08 2016 +0100
Committer:  Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Tue Apr 19 22:05:41 2016 +0200

    mtd: nand: sunxi: fix the NFC_ECC_ERR_CNT() macro
    
    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 at free-electrons.com>
---
 drivers/mtd/nand/sunxi_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index 4dcc0e4..4cb5c6f 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -154,7 +154,7 @@
 /* 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
 



More information about the linux-mtd-cvs mailing list