aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/jz4740_nand.c
diff options
context:
space:
mode:
authorBoris BREZILLON <boris.brezillon@free-electrons.com>2015-12-30 20:32:03 +0100
committerBrian Norris <computersforpeace@gmail.com>2016-01-06 18:45:46 -0800
commit6e9411923b8f4c0e568cbae0f35b7ee4eb989914 (patch)
treeec7bf6355c95b14fd19794119d7fd5fbfb9e0186 /drivers/mtd/nand/jz4740_nand.c
parentdoc: dt: mtd: new binding for jz4780-{nand,bch} (diff)
downloadlinux-dev-6e9411923b8f4c0e568cbae0f35b7ee4eb989914.tar.xz
linux-dev-6e9411923b8f4c0e568cbae0f35b7ee4eb989914.zip
mtd: nand: return consistent error codes in ecc.correct() implementations
The error code returned by the ecc.correct() are not consistent over the all implementations. Document the expected behavior in include/linux/mtd/nand.h and fix offending implementations. [Brian: this looks like a bugfix for the ECC reporting in the bf5xx_nand driver, but we haven't seen any testing results for it] Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Tested-by: Franklin S Cooper Jr. <fcooper@ti.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/nand/jz4740_nand.c')
-rw-r--r--drivers/mtd/nand/jz4740_nand.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c
index a2363d33cecc..adccae3da120 100644
--- a/drivers/mtd/nand/jz4740_nand.c
+++ b/drivers/mtd/nand/jz4740_nand.c
@@ -254,7 +254,7 @@ static int jz_nand_correct_ecc_rs(struct mtd_info *mtd, uint8_t *dat,
} while (!(status & JZ_NAND_STATUS_DEC_FINISH) && --timeout);
if (timeout == 0)
- return -1;
+ return -ETIMEDOUT;
reg = readl(nand->base + JZ_REG_NAND_ECC_CTRL);
reg &= ~JZ_NAND_ECC_CTRL_ENABLE;
@@ -262,7 +262,7 @@ static int jz_nand_correct_ecc_rs(struct mtd_info *mtd, uint8_t *dat,
if (status & JZ_NAND_STATUS_ERROR) {
if (status & JZ_NAND_STATUS_UNCOR_ERROR)
- return -1;
+ return -EBADMSG;
error_count = (status & JZ_NAND_STATUS_ERR_COUNT) >> 29;