From 7b8981af83b2c6decad32673111dce8d416dbb2e Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 11 Jan 2017 11:53:51 +0100 Subject: nandwrite: replace erase loop with mtd_erase_multi Signed-off-by: David Oberhollenzer --- nand-utils/nandwrite.c | 15 +++++++-------- 1 file 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) { -- cgit v1.2.3