[flashrom] [PATCH 1/1] Fix programmer-centric probe (patch v2)

Michael Karcher flashrom at mkarcher.dialup.fu-berlin.de
Thu Dec 22 08:15:39 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.

patch v2:
  prevent probing one chip per programmer even if the array is full. Using
  a do-while loop was a bad idea.

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

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





More information about the flashrom mailing list