diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-06-08 03:59:07 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-06-11 10:23:37 -0400 |
commit | 1a49af2ca019dcb4614c32f832bbcb814b61409c (patch) | |
tree | 1ab9382a4f2433018b9a38c2449baa835373b51b /drivers/mtd/ubi | |
parent | 0798cea8c2e1afee59686c51d27d0e96b05e42d1 (diff) |
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: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r-- | drivers/mtd/ubi/io.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index b812f8805367..ffb230339558 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -150,6 +150,8 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, | |||
150 | retry: | 150 | retry: |
151 | err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf); | 151 | err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf); |
152 | if (err) { | 152 | if (err) { |
153 | const char errstr = (err == -EBADMSG) ? "ECC error" : ""; | ||
154 | |||
153 | if (err == -EUCLEAN) { | 155 | if (err == -EUCLEAN) { |
154 | /* | 156 | /* |
155 | * -EUCLEAN is reported if there was a bit-flip which | 157 | * -EUCLEAN is reported if there was a bit-flip which |
@@ -165,15 +167,15 @@ retry: | |||
165 | } | 167 | } |
166 | 168 | ||
167 | if (read != len && retries++ < UBI_IO_RETRIES) { | 169 | if (read != len && retries++ < UBI_IO_RETRIES) { |
168 | dbg_io("error %d while reading %d bytes from PEB %d:%d," | 170 | dbg_io("error %d%s while reading %d bytes from PEB %d:%d," |
169 | " read only %zd bytes, retry", | 171 | " read only %zd bytes, retry", |
170 | err, len, pnum, offset, read); | 172 | err, errstr, len, pnum, offset, read); |
171 | yield(); | 173 | yield(); |
172 | goto retry; | 174 | goto retry; |
173 | } | 175 | } |
174 | 176 | ||
175 | ubi_err("error %d while reading %d bytes from PEB %d:%d, " | 177 | ubi_err("error %d while reading %d bytes from PEB %d:%d, " |
176 | "read %zd bytes", err, len, pnum, offset, read); | 178 | "read %zd bytes", err, errstr, len, pnum, offset, read); |
177 | ubi_dbg_dump_stack(); | 179 | ubi_dbg_dump_stack(); |
178 | 180 | ||
179 | /* | 181 | /* |