[flashrom] [PATCH 2/3] Not for merge: Warn if we skipped all blocks

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Mon Jul 23 15:33:59 CEST 2012


Quick hack to print a warning if we skip all blocks because they are already
equal to the requested image. We want something like this to make users
aware... and some developers that regularly fall for this too *coughcough*.

Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
---
 flashrom.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/flashrom.c b/flashrom.c
index 70687ff..ebc3118 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1218,6 +1218,7 @@ static int selfcheck_eraseblocks(const struct flashchip *flash)
 	return ret;
 }
 
+static int all_skipped = 1;
 static int erase_and_write_block_helper(struct flashctx *flash,
 					unsigned int start, unsigned int len,
 					uint8_t *curcontents,
@@ -1266,6 +1267,8 @@ static int erase_and_write_block_helper(struct flashctx *flash,
 	}
 	if (skip)
 		msg_cdbg("S");
+	else
+		all_skipped = 0;
 	return ret;
 }
 
@@ -1391,6 +1394,8 @@ int erase_and_write_flash(struct flashctx *flash, uint8_t *oldcontents,
 	if (ret) {
 		msg_cerr("FAILED!\n");
 	} else {
+		if(all_skipped)
+			msg_cinfo("\nWarning: Chip contents were already identical to the requested image.\n");
 		msg_cinfo("Erase/write done.\n");
 	}
 	return ret;
-- 
Kind regards, Stefan Tauner





More information about the flashrom mailing list