Move the error message about a failure to read a PEB to the caller. In some cases like for example i.MX6 with NAND boot it can happen that mtd_peb_read() is called on the NAND blocks containing the FCB. These are not protected with regular ECC, so are not readable. The error message is expected and harmless. UBI needs this error message though, so move it there. Other callers have their own error message already.
Signed-off-by: Sascha Hauer <[email protected]> --- drivers/mtd/peb.c | 2 +- drivers/mtd/ubi/io.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/peb.c b/drivers/mtd/peb.c index 840fc1799a..10ccf188c7 100644 --- a/drivers/mtd/peb.c +++ b/drivers/mtd/peb.c @@ -239,7 +239,7 @@ int mtd_peb_read(struct mtd_info *mtd, void *buf, int pnum, int offset, if (mtd_is_eccerr(err) && retries++ < MTD_IO_RETRIES) goto retry; - dev_err(&mtd->dev, "error %d%s while reading %d bytes from PEB %d:%d\n", + dev_dbg(&mtd->dev, "error %d%s while reading %d bytes from PEB %d:%d\n", err, errstr, len, pnum, offset); return err; } diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 88df185789..340a601426 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c @@ -115,6 +115,14 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, ret = mtd_peb_read(ubi->mtd, buf, pnum, offset, len); if (mtd_is_bitflip(ret)) return UBI_IO_BITFLIPS; + + if (ret) { + const char *errstr = mtd_is_eccerr(ret) ? " (ECC error)" : ""; + + ubi_err(ubi, "error %d%s while reading %d bytes from PEB %d:%d\n", + ret, errstr, len, pnum, offset); + } + return ret; } -- 2.47.3
