mtdblock: tolerate corrected bit-flips
PATCH 1/1 mtdblock: tolerate corrected bit-flips
mtd_read() may return -EUCLEAN in case of corrected bit-flips.This particular condition should not be treated like an error.
Signed-off-by Bang Li <[email protected]>
--- drivers/mtd/mtdblock_ro.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/mtdblock_ro.c +3 -1
@@ -16,8 +16,10 @@ static int mtdblock_readsect(struct mtd_blktrans_dev *dev, unsigned long block, char *buf) { size_t retlen; +int err; -if (mtd_read (dev->mtd, (block *512 ),512 , &retlen, buf)) + err =mtd_read (dev->mtd, (block *512 ),512 , &retlen, buf); +if (err && !mtd_is_bitflip (err))return 1 ;return 0 ; }
Signature · 1 line
2.25.1
Quoted 4 lines · Bang Li
mtd_read()may return-EUCLEANin case of corrected bit-flips.This particular condition should not be treated like an error.Signed-off-by Bang Li <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel