[flashrom] [commit] r1680 - trunk

repository service svn at flashrom.org
Mon Jun 24 00:15:39 CEST 2013


Author: stefanct
Date: Mon Jun 24 00:15:39 2013
New Revision: 1680
URL: http://flashrom.org/trac/flashrom/changeset/1680

Log:
Warn if we skipped all blocks while writing.

Quick hack to print a warning if we skip all blocks in a write
process because they are already equal to the requested image. We
want something like this to make users aware... and some developers
who regularly fall for this too *coughcough*. There might be more
elegant solutions for this... patches welcome.

This does not work for erasing because we do that unconditionally.

Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
Acked-by: Idwer Vollering <vidwer at gmail.com>

Modified:
   trunk/flash.h
   trunk/flashrom.c

Modified: trunk/flash.h
==============================================================================
--- trunk/flash.h	Fri Jun 21 00:55:41 2013	(r1679)
+++ trunk/flash.h	Mon Jun 24 00:15:39 2013	(r1680)
@@ -27,6 +27,7 @@
 #include <inttypes.h>
 #include <stdint.h>
 #include <stddef.h>
+#include <stdbool.h>
 #ifdef _WIN32
 #include <windows.h>
 #undef min

Modified: trunk/flashrom.c
==============================================================================
--- trunk/flashrom.c	Fri Jun 21 00:55:41 2013	(r1679)
+++ trunk/flashrom.c	Mon Jun 24 00:15:39 2013	(r1680)
@@ -1310,6 +1310,7 @@
 	return ret;
 }
 
+static bool all_skipped = true;
 static int erase_and_write_block_helper(struct flashctx *flash,
 					unsigned int start, unsigned int len,
 					uint8_t *curcontents,
@@ -1357,6 +1358,8 @@
 	}
 	if (skip)
 		msg_cdbg("S");
+	else
+		all_skipped = false;
 	return ret;
 }
 
@@ -1483,6 +1486,8 @@
 	if (ret) {
 		msg_cerr("FAILED!\n");
 	} else {
+		if (all_skipped)
+			msg_cinfo("\nWarning: Chip content is identical to the requested image.\n");
 		msg_cinfo("Erase/write done.\n");
 	}
 	return ret;




More information about the flashrom mailing list