summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-07-23 01:42:56 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-07-23 01:42:56 +0000
commit74461299effbef0b86b554bd789efab3c54e117f (patch)
tree17e683580b2b7ed1f0ce12a05f52ab06f11e599c
parent785ede988e5c8ab924da7607d6d0f2665aaabf28 (diff)
downloadflashrom-74461299effbef0b86b554bd789efab3c54e117f.zip
flashrom-74461299effbef0b86b554bd789efab3c54e117f.tar.gz
Continue erase/write verification after the first error
The first error is printed in detail and all subsequent errors are listed in statistics. This allows users to check if there was just one error or if the failure was widespread. Corresponding to flashrom svn r663. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Stefan Reinauer <stepan@coresystems.de>
-rw-r--r--flashrom.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/flashrom.c b/flashrom.c
index 11efd25..5764872 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -278,6 +278,7 @@ int verify_range(struct flashchip *flash, uint8_t *cmpbuf, int start, int len, c
int i, j, starthere, lenhere, ret = 0;
int page_size = flash->page_size;
uint8_t *readbuf = malloc(page_size);
+ int failcount = 0;
if (!len)
goto out_free;
@@ -318,15 +319,21 @@ int verify_range(struct flashchip *flash, uint8_t *cmpbuf, int start, int len, c
flash->read(flash, readbuf, starthere, lenhere);
for (j = 0; j < lenhere; j++) {
if (cmpbuf[starthere - start + j] != readbuf[j]) {
- fprintf(stderr, "%s FAILED at 0x%08x! "
- "Expected=0x%02x, Read=0x%02x\n",
- message, starthere + j,
- cmpbuf[starthere - start + j], readbuf[j]);
- ret = -1;
- goto out_free;
+ /* Only print the first failure. */
+ if (!failcount++)
+ fprintf(stderr, "%s FAILED at 0x%08x! "
+ "Expected=0x%02x, Read=0x%02x,",
+ message, starthere + j,
+ cmpbuf[starthere - start + j],
+ readbuf[j]);
}
}
}
+ if (failcount) {
+ fprintf(stderr, " failed byte count from 0x%08x-0x%08x: 0x%x\n",
+ start, start + len - 1, failcount);
+ ret = -1;
+ }
out_free:
free(readbuf);
OpenPOWER on IntegriCloud