summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-20 13:26:09 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-23 14:20:01 +0100
commit66d7674f8babfebac46ee203f7d64deda0d7ab21 (patch)
treeb3932769cc1e4a8203f218c2d8358caca55d0337
parent26a1aedb1b38f625c037d31381f721ac55f4420f (diff)
downloadbarebox-66d7674f8babfebac46ee203f7d64deda0d7ab21.tar.gz
barebox-66d7674f8babfebac46ee203f7d64deda0d7ab21.tar.xz
mtd: fix reading data from page that needs cleanup
mtd_read´() returns -EUCLEAN to indicate that a page needs cleanup. This value shouldn't be returned from the mtd read file operation since this should return the number of bytes read. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/mtd/core.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 90b800c7b2..4e7bfdb3da 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -105,11 +105,10 @@ static ssize_t mtd_op_read(struct cdev *cdev, void* buf, size_t count,
offset, count);
ret = mtd_read(mtd, offset, count, &retlen, buf);
- if (ret < 0)
+ if (ret < 0 && ret != -EUCLEAN)
return ret;
- if (mtd->ecc_strength == 0)
- return retlen; /* device lacks ecc */
- return ret >= mtd->bitflip_threshold ? -EUCLEAN : retlen;
+
+ return retlen;
}
#define NOTALIGNED(x) (x & (mtd->writesize - 1)) != 0