mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] ubiformat: Ignore bitflip errors
@ 2016-05-20  5:58 Sascha Hauer
  2016-05-20  5:58 ` [PATCH 2/2] ubiformat: Fix formatting devices with unreadable areas Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2016-05-20  5:58 UTC (permalink / raw)
  To: Barebox List

Fixes: 1d88c66 ubiformat: Use mtd-peb API

bit flips are no error, when encountering them during scanning of a
device just ignore them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 lib/libscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libscan.c b/lib/libscan.c
index bf298a7..13bd625 100644
--- a/lib/libscan.c
+++ b/lib/libscan.c
@@ -82,7 +82,7 @@ int libscan_ubi_scan(struct mtd_info *mtd, struct ubi_scan_info **info,
 		}
 
 		ret = mtd_peb_read(mtd, &ech, eb, 0, sizeof(struct ubi_ec_hdr));
-		if (ret < 0)
+		if (ret < 0 && !mtd_is_bitflip(ret))
 			goto out_ec;
 
 		if (be32_to_cpu(ech.magic) != UBI_EC_HDR_MAGIC) {
-- 
2.8.0.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] ubiformat: Fix formatting devices with unreadable areas
  2016-05-20  5:58 [PATCH 1/2] ubiformat: Ignore bitflip errors Sascha Hauer
@ 2016-05-20  5:58 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2016-05-20  5:58 UTC (permalink / raw)
  To: Barebox List

When parts of a Nand device are not readable due to excessive bit flips
we should not bail out with an error as this means we can never repair
the device by flashing a fresh image using ubiformat. Instead, treat a
failed read as a corrupt block and ignore the read failure.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 lib/libscan.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/libscan.c b/lib/libscan.c
index 13bd625..74a24b5 100644
--- a/lib/libscan.c
+++ b/lib/libscan.c
@@ -82,8 +82,13 @@ int libscan_ubi_scan(struct mtd_info *mtd, struct ubi_scan_info **info,
 		}
 
 		ret = mtd_peb_read(mtd, &ech, eb, 0, sizeof(struct ubi_ec_hdr));
-		if (ret < 0 && !mtd_is_bitflip(ret))
-			goto out_ec;
+		if (ret < 0 && !mtd_is_bitflip(ret)) {
+			si->corrupted_cnt += 1;
+			si->ec[eb] = EB_CORRUPTED;
+			if (v)
+				printf(": not readable\n");
+			continue;
+		}
 
 		if (be32_to_cpu(ech.magic) != UBI_EC_HDR_MAGIC) {
 			if (mtd_buf_all_ff(&ech, sizeof(struct ubi_ec_hdr))) {
-- 
2.8.0.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-20  5:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-20  5:58 [PATCH 1/2] ubiformat: Ignore bitflip errors Sascha Hauer
2016-05-20  5:58 ` [PATCH 2/2] ubiformat: Fix formatting devices with unreadable areas Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox