From 262a2c625e84d9481d2841b0eb674f8e0440a36a Mon Sep 17 00:00:00 2001 From: "Fryar, Jeff" Date: Thu, 11 Aug 2011 16:30:33 +0100 Subject: nandwrite: invalid erase after page write failure mtd-utils nandwrite.c: After a page write failure, the calculation of the block number to erase is incorrect. The erase block size is being passed as the erase block number in the call to mtd_erase(). Signed-off-by: Jeff Fryar Signed-off-by: Artem Bityutskiy --- nandwrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nandwrite.c b/nandwrite.c index 1700d61..d41ae86 100644 --- a/nandwrite.c +++ b/nandwrite.c @@ -659,7 +659,7 @@ 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, 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) { -- cgit v1.2.3