diff options
author | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-29 14:56:39 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-29 15:06:51 +0200 |
commit | 9a1fcdfd4bee27c418424cac47abf7c049541297 (patch) | |
tree | 5baa5f1e1d1a296a319bf6a5a4b636668c107e00 /drivers/mtd/mtdconcat.c | |
parent | 8593fbc68b0df1168995de76d1af38eb62fd6b62 (diff) | |
download | linux-9a1fcdfd4bee27c418424cac47abf7c049541297.tar.gz linux-9a1fcdfd4bee27c418424cac47abf7c049541297.tar.bz2 linux-9a1fcdfd4bee27c418424cac47abf7c049541297.zip |
[MTD] NAND Signal that a bitflip was corrected by ECC
Return -EUCLEAN on read when a bitflip was detected and corrected, so the
clients can react and eventually copy the affected block to a spare one.
Make all in kernel users aware of the change.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd/mtdconcat.c')
-rw-r--r-- | drivers/mtd/mtdconcat.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 38151b8e6631..3c8d5e6fa010 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -56,7 +56,7 @@ concat_read(struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf) { struct mtd_concat *concat = CONCAT(mtd); - int err = -EINVAL; + int ret = 0, err = -EINVAL; int i; *retlen = 0; @@ -80,9 +80,18 @@ concat_read(struct mtd_info *mtd, loff_t from, size_t len, err = subdev->read(subdev, from, size, &retsize, buf); - if (err) + if (err && (err != -EBADMSG) && (err != -EUCLEAN)) break; + /* Save information about bitflips! */ + if (err) { + if (err == -EBADMSG) + ret = err; + else if (!ret) + ret = err; + err = 0; + } + *retlen += retsize; len -= size; if (len == 0) @@ -92,7 +101,7 @@ concat_read(struct mtd_info *mtd, loff_t from, size_t len, buf += size; from = 0; } - return err; + return err ? err : ret; } static int |