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/inftlcore.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers/mtd/inftlcore.c') diff --git a/drivers/mtd/inftlcore.c b/drivers/mtd/inftlcore.c index efb1a95aa0a..1e21a2c3dd2 100644 --- a/drivers/mtd/inftlcore.c +++ b/drivers/mtd/inftlcore.c @@ -355,7 +355,7 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned ret = mtd->read(mtd, (inftl->EraseSize * BlockMap[block]) + (block * SECTORSIZE), SECTORSIZE, &retlen, movebuf); - if (ret < 0) { + if (ret < 0 && ret != -EUCLEAN) { ret = mtd->read(mtd, (inftl->EraseSize * BlockMap[block]) + (block * SECTORSIZE), SECTORSIZE, @@ -922,7 +922,10 @@ foundit: } else { size_t retlen; loff_t ptr = (thisEUN * inftl->EraseSize) + blockofs; - if (mtd->read(mtd, ptr, SECTORSIZE, &retlen, buffer)) + int ret = mtd->read(mtd, ptr, SECTORSIZE, &retlen, buffer); + + /* Handle corrected bit flips gracefully */ + if (ret < 0 && ret != -EUCLEAN) return -EIO; } return 0; -- cgit v1.2.3