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>
This commit is contained in:
parent
26a1aedb1b
commit
66d7674f8b
|
@ -105,11 +105,10 @@ static ssize_t mtd_op_read(struct cdev *cdev, void* buf, size_t count,
|
||||||
offset, count);
|
offset, count);
|
||||||
|
|
||||||
ret = mtd_read(mtd, offset, count, &retlen, buf);
|
ret = mtd_read(mtd, offset, count, &retlen, buf);
|
||||||
if (ret < 0)
|
if (ret < 0 && ret != -EUCLEAN)
|
||||||
return ret;
|
return ret;
|
||||||
if (mtd->ecc_strength == 0)
|
|
||||||
return retlen; /* device lacks ecc */
|
return retlen;
|
||||||
return ret >= mtd->bitflip_threshold ? -EUCLEAN : retlen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NOTALIGNED(x) (x & (mtd->writesize - 1)) != 0
|
#define NOTALIGNED(x) (x & (mtd->writesize - 1)) != 0
|
||||||
|
|
Loading…
Reference in New Issue