[flashrom] [PATCH 1/1] Fix programmer-centric probe

Michael Karcher flashrom at mkarcher.dialup.fu-berlin.de
Thu Dec 22 01:38:09 CET 2011


As reported by Stefan Tauner on IRC, the new programmer-centric logic
is broken by re-using occupied members of the flashes array when changing
to the next programmer. This fixes it

Signed-off-by: Michael Karcher <flashrom at mkarcher.dialup.fu-berlin.de>
---
 cli_classic.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/cli_classic.c b/cli_classic.c
index 543b644..10ed0f4 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -451,14 +451,17 @@ int main(int argc, char *argv[])
 
 	for (j = 0; j < registered_programmer_count; j++) {
 		startchip = 0;
-		for (i = 0; i < ARRAY_SIZE(flashes); i++) {
+		do {
 			startchip = probe_flash(&registered_programmers[j],
-						startchip, &flashes[i], 0);
-			if (startchip == -1)
-				break;
-			chipcount++;
-			startchip++;
+						startchip, 
+						&flashes[chipcount], 0);
+			if (startchip != -1)
+			{
+				chipcount++;
+				startchip++;
+			}
 		}
+		while( startchip != -1 && chipcount < ARRAY_SIZE(flashes) );
 	}
 
 	if (chipcount > 1) {
-- 
1.7.7.3





More information about the flashrom mailing list