[BUG] mtd-utils: nandwrite: invalid erase after page write failure
Fryar, Jeff
jeff.fryar at hp.com
Thu Aug 11 11:30:33 EDT 2011
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().
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