mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Fabian Pfitzner <f.pfitzner@pengutronix.de>
Subject: [PATCH] mtd: peb: mtd_peb_read(): move error message to caller
Date: Wed, 29 Oct 2025 14:16:17 +0100	[thread overview]
Message-ID: <20251029131617.1607191-1-s.hauer@pengutronix.de> (raw)

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 <s.hauer@pengutronix.de>
---
 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




                 reply	other threads:[~2025-10-29 13:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251029131617.1607191-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=f.pfitzner@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox