aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nand-utils/nandwrite.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/nand-utils/nandwrite.c b/nand-utils/nandwrite.c
index 998c68c..22c741d 100644
--- a/nand-utils/nandwrite.c
+++ b/nand-utils/nandwrite.c
@@ -540,7 +540,6 @@ int main(int argc, char * const argv[])
}
if (ret) {
- long long i;
if (errno != EIO) {
sys_errmsg("%s: MTD write failure", mtd_device);
goto closeall;
@@ -551,13 +550,13 @@ int main(int argc, char * const argv[])
fprintf(stderr, "Erasing failed write from %#08llx to %#08llx\n",
blockstart, blockstart + ebsize_aligned - 1);
- for (i = blockstart; i < blockstart + ebsize_aligned; i += mtd.eb_size) {
- if (mtd_erase(mtd_desc, &mtd, fd, i / mtd.eb_size)) {
- int errno_tmp = errno;
- sys_errmsg("%s: MTD Erase failure", mtd_device);
- if (errno_tmp != EIO)
- goto closeall;
- }
+
+ if (mtd_erase_multi(mtd_desc, &mtd, fd,
+ blockstart / mtd.eb_size, blockalign)) {
+ int errno_tmp = errno;
+ sys_errmsg("%s: MTD Erase failure", mtd_device);
+ if (errno_tmp != EIO)
+ goto closeall;
}
if (markbad) {