From 9a1fcdfd4bee27c418424cac47abf7c049541297 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 29 May 2006 14:56:39 +0200 Subject: [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 --- drivers/mtd/mtdconcat.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'drivers/mtd/mtdconcat.c') 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 -- cgit v1.2.3