[flashrom] [commit] r1238 - trunk
repository service
svn at flashrom.org
Thu Dec 2 03:41:56 CET 2010
Author: hailfinger
Date: Thu Dec 2 03:41:55 2010
New Revision: 1238
URL: http://flashrom.org/trac/flashrom/changeset/1238
Log:
Handle erase failure in partial write.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Acked-by: Michael Karcher <flashrom at mkarcher.dialup.fu-berlin.de>
Modified:
trunk/flashrom.c
Modified: trunk/flashrom.c
==============================================================================
--- trunk/flashrom.c Mon Nov 29 01:37:49 2010 (r1237)
+++ trunk/flashrom.c Thu Dec 2 03:41:55 2010 (r1238)
@@ -1468,11 +1468,20 @@
/* If everything is OK, don't try another erase function. */
if (!ret)
break;
- /* FIXME: Reread the whole chip here so we know the current
- * chip contents? curcontents might be up to date, but this
- * code is only reached if something failed, and then we don't
- * know exactly what failed, and how.
+ /* Write/erase failed, so try to find out what the current chip
+ * contents are. If no usable erase functions remain, we could
+ * abort the loop instead of continuing, the effect is the same.
+ * The only difference is whether the reason for other unusable
+ * functions is printed or not. If in doubt, verbosity wins.
*/
+ if (flash->read(flash, curcontents, 0, size)) {
+ /* Now we are truly screwed. Read failed as well. */
+ msg_cerr("Can't read anymore!\n");
+ /* We have no idea about the flash chip contents, so
+ * retrying with another erase function is pointless.
+ */
+ break;
+ }
}
/* Free the scratchpad. */
free(curcontents);
More information about the flashrom
mailing list