[flashrom] [commit] r663 - trunk

svn at flashrom.org svn at flashrom.org
Thu Jul 23 03:42:56 CEST 2009


Author: hailfinger
Date: 2009-07-23 03:42:56 +0200 (Thu, 23 Jul 2009)
New Revision: 663

Modified:
   trunk/flashrom.c
Log:
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.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Acked-by: Stefan Reinauer <stepan at coresystems.de>


Modified: trunk/flashrom.c
===================================================================
--- trunk/flashrom.c	2009-07-23 01:40:20 UTC (rev 662)
+++ trunk/flashrom.c	2009-07-23 01:42:56 UTC (rev 663)
@@ -278,6 +278,7 @@
 	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 @@
 		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);





More information about the flashrom mailing list