mtd: fix wrong return values in cdev read
mtd->read returns the number of bitflips as positive numbers. Instead of returning these numbers Return -EUCLEAN when the bitflip threshold has been reached, 0 otherwise. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
26f2c815d1
commit
a8fd9bfd12
|
@ -75,12 +75,11 @@ 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) {
|
||||
printf("err %d\n", ret);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
return retlen;
|
||||
if (mtd->ecc_strength == 0)
|
||||
return retlen; /* device lacks ecc */
|
||||
return ret >= mtd->bitflip_threshold ? -EUCLEAN : retlen;
|
||||
}
|
||||
|
||||
#define NOTALIGNED(x) (x & (mtd->writesize - 1)) != 0
|
||||
|
|
Loading…
Reference in New Issue