summaryrefslogtreecommitdiff
path: root/tests/mtd-tests/nandbiterrs.c
diff options
context:
space:
mode:
authorHarpreet Eli Sangha <harpreet@nestlabs.com>2017-06-27 13:52:26 -0700
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2017-06-28 10:26:27 +0200
commitb0b1bc51496b7c328fcda3e6164292fa0d1dbc18 (patch)
tree103eaaf1474707d6c086dc63b9379390e7c4f56c /tests/mtd-tests/nandbiterrs.c
parent76e27a79eddb6279bbbc0ec840d66b753a9ba0f3 (diff)
mtd-utils: tests: Fix nandbiterrs Failure Check
After a page read, the old failure statistics are compared against the new failure statistics before the new values are actually read. Signed-off-by: Harpreet "Eli" Sangha <harpreet@nestlabs.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/mtd-tests/nandbiterrs.c')
-rw-r--r--tests/mtd-tests/nandbiterrs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/mtd-tests/nandbiterrs.c b/tests/mtd-tests/nandbiterrs.c
index 6acbfee..de9d0dd 100644
--- a/tests/mtd-tests/nandbiterrs.c
+++ b/tests/mtd-tests/nandbiterrs.c
@@ -268,15 +268,15 @@ static int read_page(void)
return -1;
}
+ if (ioctl(fd, ECCGETSTATS, &new) != 0)
+ goto failstats;
+
if (new.failed > old.failed) {
fprintf(stderr, "Failed to recover %d bitflips\n",
new.failed - old.failed);
return -1;
}
- if (ioctl(fd, ECCGETSTATS, &new) != 0)
- goto failstats;
-
return new.corrected - old.corrected;
failstats:
perror("ECCGETSTATS");