Fix stupid i++ evalution order bug
Corresponding to flashrom svn r9 and coreboot v2 svn r1435.
diff --git a/flash_rom.c b/flash_rom.c
index 13bb182..d57957d 100644
--- a/flash_rom.c
+++ b/flash_rom.c
@@ -141,7 +141,7 @@
volatile char * bios = flash->virt_addr;
printf("Verifying address: ");
- while (i++ < total_size) {
+ while (i < total_size) {
if (verbose)
printf("0x%08x", i);
if (*(bios+i) != *(buf+i)) {
@@ -150,6 +150,7 @@
}
if (verbose)
printf("\b\b\b\b\b\b\b\b\b\b");
+ i++
}
if (verbose)
printf("\n");
@@ -178,12 +179,12 @@
FILE * image;
struct flashchip * flash;
int opt;
- int read_it = 0, write_it = 0, verify_it = 0;
+ int read_it = 0, write_it = 0, verify_it = 0, verbose = 0;
char *filename = NULL;
setbuf(stdout, NULL);
- while ((opt = getopt(argc, argv, "rwvc:")) != EOF) {
+ while ((opt = getopt(argc, argv, "rwvVc:")) != EOF) {
switch (opt) {
case 'r':
read_it = 1;
@@ -197,6 +198,9 @@
case 'c':
chip_to_probe = strdup(optarg);
break;
+ case 'V':
+ verbose = 1;
+ break;
default:
usage(argv[0]);
break;
@@ -257,6 +261,6 @@
if (write_it || (!read_it && !verify_it))
flash->write (flash, buf);
if (verify_it)
- verify_flash (flash, buf, /* verbose = */ 0);
+ verify_flash (flash, buf, verbose);
return 0;
}