[BUG] mtd-utils: nandwrite: invalid erase after page write failure

Fryar, Jeff jeff.fryar at hp.com
Wed Aug 17 00:42:31 EDT 2011


Suggested fix (now with more whitespace)  :)

Jeff Fryar <jeff.fryar at hp.com>


--- mtd-utils-f1fe865/nandwrite.c.ORIG  2011-07-20 00:28:52.000000000 -0500
+++ mtd-utils-f1fe865/nandwrite.c       2011-08-11 09:19:12.000000000 -0500
@@ -659,7 +659,7 @@
                        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) {



More information about the linux-mtd mailing list