fixed stupid i++ evalution order bug
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1435 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
26b237ee18
commit
df273a58a3
|
@ -141,7 +141,7 @@ int verify_flash (struct flashchip * flash, char * buf, int verbose)
|
||||||
volatile char * bios = flash->virt_addr;
|
volatile char * bios = flash->virt_addr;
|
||||||
|
|
||||||
printf("Verifying address: ");
|
printf("Verifying address: ");
|
||||||
while (i++ < total_size) {
|
while (i < total_size) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("0x%08x", i);
|
printf("0x%08x", i);
|
||||||
if (*(bios+i) != *(buf+i)) {
|
if (*(bios+i) != *(buf+i)) {
|
||||||
|
@ -150,6 +150,7 @@ int verify_flash (struct flashchip * flash, char * buf, int verbose)
|
||||||
}
|
}
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b");
|
printf("\b\b\b\b\b\b\b\b\b\b");
|
||||||
|
i++
|
||||||
}
|
}
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -178,12 +179,12 @@ int main (int argc, char * argv[])
|
||||||
FILE * image;
|
FILE * image;
|
||||||
struct flashchip * flash;
|
struct flashchip * flash;
|
||||||
int opt;
|
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;
|
char *filename = NULL;
|
||||||
|
|
||||||
setbuf(stdout, NULL);
|
setbuf(stdout, NULL);
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "rwvc:")) != EOF) {
|
while ((opt = getopt(argc, argv, "rwvVc:")) != EOF) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'r':
|
case 'r':
|
||||||
read_it = 1;
|
read_it = 1;
|
||||||
|
@ -197,6 +198,9 @@ int main (int argc, char * argv[])
|
||||||
case 'c':
|
case 'c':
|
||||||
chip_to_probe = strdup(optarg);
|
chip_to_probe = strdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
verbose = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
break;
|
break;
|
||||||
|
@ -257,6 +261,6 @@ int main (int argc, char * argv[])
|
||||||
if (write_it || (!read_it && !verify_it))
|
if (write_it || (!read_it && !verify_it))
|
||||||
flash->write (flash, buf);
|
flash->write (flash, buf);
|
||||||
if (verify_it)
|
if (verify_it)
|
||||||
verify_flash (flash, buf, /* verbose = */ 0);
|
verify_flash (flash, buf, verbose);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue