mtd: nand: sunxi: fix sunxi_nfc_hw_ecc_read/write_chunk()
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Tue, 20 Oct 2015 20:16:00 +0000 (22:16 +0200)
committerBrian Norris <computersforpeace@gmail.com>
Mon, 2 Nov 2015 20:54:25 +0000 (12:54 -0800)
The sunxi_nfc_hw_ecc_read/write_chunk() functions try to avoid changing
the column address if unnecessary, but the logic to determine whether it's
necessary or not is currently wrong: it adds the ecc->bytes value to the
current offset where it should actually add ecc->size.

Fixes: 913821bdd211 ("mtd: nand: sunxi: introduce sunxi_nfc_hw_ecc_read/write_chunk()")
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/nand/sunxi_nand.c

index ef46ac66248bb49112fcd0ed2ab5b8f3c7f6735f..96f7370a404fa17b7228a128cb0fb7d598000b4b 100644 (file)
@@ -588,7 +588,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,
 
        sunxi_nfc_read_buf(mtd, data, ecc->size);
 
-       if (data_off + ecc->bytes != oob_off)
+       if (data_off + ecc->size != oob_off)
                nand->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_off, -1);
 
        ret = sunxi_nfc_wait_cmd_fifo_empty(nfc);
@@ -679,7 +679,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd,
        writel(sunxi_nfc_buf_to_user_data(oob),
               nfc->regs + NFC_REG_USER_DATA(0));
 
-       if (data_off + ecc->bytes != oob_off)
+       if (data_off + ecc->size != oob_off)
                nand->cmdfunc(mtd, NAND_CMD_RNDIN, oob_off, -1);
 
        ret = sunxi_nfc_wait_cmd_fifo_empty(nfc);