Commit 1a49af2c authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBI: improve ECC error message

ECC errors are quite typical errors on NAND, so it is worth improving
the UBI message and print something like

ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 1:4 ...

rather than

ubi_io_read: error -74 while reading 4096 bytes from PEB 1:4 ...
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 0798cea8
...@@ -150,6 +150,8 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, ...@@ -150,6 +150,8 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset,
retry: retry:
err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf); err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf);
if (err) { if (err) {
const char errstr = (err == -EBADMSG) ? "ECC error" : "";
if (err == -EUCLEAN) { if (err == -EUCLEAN) {
/* /*
* -EUCLEAN is reported if there was a bit-flip which * -EUCLEAN is reported if there was a bit-flip which
...@@ -165,15 +167,15 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, ...@@ -165,15 +167,15 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset,
} }
if (read != len && retries++ < UBI_IO_RETRIES) { if (read != len && retries++ < UBI_IO_RETRIES) {
dbg_io("error %d while reading %d bytes from PEB %d:%d," dbg_io("error %d%s while reading %d bytes from PEB %d:%d,"
" read only %zd bytes, retry", " read only %zd bytes, retry",
err, len, pnum, offset, read); err, errstr, len, pnum, offset, read);
yield(); yield();
goto retry; goto retry;
} }
ubi_err("error %d while reading %d bytes from PEB %d:%d, " ubi_err("error %d while reading %d bytes from PEB %d:%d, "
"read %zd bytes", err, len, pnum, offset, read); "read %zd bytes", err, errstr, len, pnum, offset, read);
ubi_dbg_dump_stack(); ubi_dbg_dump_stack();
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment