summaryrefslogtreecommitdiff
path: root/ubi-utils/src/ubiformat.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-07-26 15:40:32 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-07-26 15:40:32 +0300
commit6624ef2ba2e9687929c53fe838910786270cd5c9 (patch)
tree28514674f90840ab2614c728b1d51699db2fdb8d /ubi-utils/src/ubiformat.c
parent5cf9d3cf66dd32bd5a348e0e9805c5d7a3c34573 (diff)
ubiformat: torture eraseblocks on write errors
When fail to write to PEBs, and the error is EIO, torture the PEB before marking it as bad. Basically, the code is copied from the kernel UBI. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/src/ubiformat.c')
-rw-r--r--ubi-utils/src/ubiformat.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ubi-utils/src/ubiformat.c b/ubi-utils/src/ubiformat.c
index 2a62f3b..c15500b 100644
--- a/ubi-utils/src/ubiformat.c
+++ b/ubi-utils/src/ubiformat.c
@@ -530,12 +530,14 @@ static int flash_image(const struct mtd_dev_info *mtd, struct ubi_scan_info *si)
if (errno != EIO)
goto out_close;
- if (mark_bad(mtd, si, eb)) {
- normsg("operation incomplete");
- goto out_close;
+ err = mtd_torture(mtd, args.node_fd, eb);
+ if (err) {
+ if (mark_bad(mtd, si, eb)) {
+ normsg("operation incomplete");
+ goto out_close;
+ }
+ divisor += 1;
}
-
- divisor += 1;
continue;
}
if (++written_ebs >= img_ebs)