mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mtd: fix reading data from page that needs cleanup
@ 2017-03-23 13:20 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2017-03-23 13:20 UTC (permalink / raw)
  To: Barebox List

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>
---
 drivers/mtd/core.c | 7 +++----
 1 file 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
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-23 13:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23 13:20 [PATCH] mtd: fix reading data from page that needs cleanup Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox