summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFryar, Jeff <jeff.fryar@hp.com>2011-08-11 16:30:33 +0100
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-08-19 20:01:59 +0300
commit262a2c625e84d9481d2841b0eb674f8e0440a36a (patch)
tree515942c7fd86ec7361ef2c791d8fb15260245e92
parentd2432457a5469804c33f3f71c5d1a5f722a9295f (diff)
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 <jeff.fryar@hp.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
-rw-r--r--nandwrite.c2
1 files changed, 1 insertions, 1 deletions
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) {