summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorBang Li <libang.linuxer@gmail.com>2023-03-15 00:56:53 +0800
committerMiquel Raynal <miquel.raynal@bootlin.com>2023-03-22 17:02:19 +0100
commite6b0922a9c614d7689393391325c943b34afd6d4 (patch)
tree35fc2b1d84abade681f223cb4c493bd93e488205 /drivers/mtd
parent57150c40b6391bc350c6016641b2a487a3de3cba (diff)
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 <libang.linuxer@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20230314165653.252673-1-libang.linuxer@gmail.com
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtdblock_ro.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/mtdblock_ro.c b/drivers/mtd/mtdblock_ro.c
index 7c51952ce55d..66ffc9f1ead2 100644
--- a/drivers/mtd/mtdblock_ro.c
+++ b/drivers/mtd/mtdblock_ro.c
@@ -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;
}