summaryrefslogtreecommitdiff
path: root/nand-utils/nandwrite.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2017-01-11 11:53:51 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2017-01-12 11:02:19 +0100
commit7b8981af83b2c6decad32673111dce8d416dbb2e (patch)
tree8836152c03e95360a6c0752b36c403bb69100bda /nand-utils/nandwrite.c
parentdffaa1d4d1cfabdf325967dd9766adde7320e05e (diff)
nandwrite: replace erase loop with mtd_erase_multi
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'nand-utils/nandwrite.c')
-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) {