]> www.infradead.org Git - mtd-utils.git/commitdiff
nandwrite: invalid erase after page write failure
authorFryar, Jeff <jeff.fryar@hp.com>
Thu, 11 Aug 2011 15:30:33 +0000 (16:30 +0100)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Fri, 19 Aug 2011 17:01:59 +0000 (20:01 +0300)
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 <jeff.fryar@hp.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
nandwrite.c

index 1700d612290e1f50a693ed7a79d213d49164017e..d41ae86122c53793226721a1c71dfca954573c11 100644 (file)
@@ -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) {