summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/r852.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/r852.c
parent6f357de854a6dfb9ce0d5d65f3971cf3d0a4af6f (diff)
downloadlinux-6e9411923b8f4c0e568cbae0f35b7ee4eb989914.tar.gz
linux-6e9411923b8f4c0e568cbae0f35b7ee4eb989914.tar.bz2
linux-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/r852.c')
-rw-r--r--drivers/mtd/nand/r852.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c
index cb0bf09214d5..5b15f2faee38 100644
--- a/drivers/mtd/nand/r852.c
+++ b/drivers/mtd/nand/r852.c
@@ -477,7 +477,7 @@ static int r852_ecc_correct(struct mtd_info *mtd, uint8_t *dat,
if (dev->dma_error) {
dev->dma_error = 0;
- return -1;
+ return -EIO;
}
r852_write_reg(dev, R852_CTL, dev->ctlreg | R852_CTL_ECC_ACCESS);
@@ -491,7 +491,7 @@ static int r852_ecc_correct(struct mtd_info *mtd, uint8_t *dat,
/* ecc uncorrectable error */
if (ecc_status & R852_ECC_FAIL) {
dbg("ecc: unrecoverable error, in half %d", i);
- error = -1;
+ error = -EBADMSG;
goto exit;
}