msrtool: Remove indent by using continue inside for() to avoid an if block
The only actual code change is from if (.. >= 1) { } to if (.. < 1) continue so this is pretty trivial. Signed-off-by: Peter Stuge <peter@stuge.se> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5020 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
6ade161442
commit
350ca4a94f
|
@ -182,7 +182,7 @@ done:
|
||||||
int do_diff(const char *difffn) {
|
int do_diff(const char *difffn) {
|
||||||
char tmpfn[20], line[512];
|
char tmpfn[20], line[512];
|
||||||
size_t start, len;
|
size_t start, len;
|
||||||
int ret = 1, tmp;
|
int ret = 1, found, tmp;
|
||||||
FILE *fin = NULL, *fout = stdout;
|
FILE *fin = NULL, *fout = stdout;
|
||||||
uint8_t rev = 0;
|
uint8_t rev = 0;
|
||||||
uint32_t addr, linenum;
|
uint32_t addr, linenum;
|
||||||
|
@ -203,19 +203,20 @@ int do_diff(const char *difffn) {
|
||||||
goto done;
|
goto done;
|
||||||
for (linenum = 1; NULL != fgets(line, sizeof(line), fin); ++linenum) {
|
for (linenum = 1; NULL != fgets(line, sizeof(line), fin); ++linenum) {
|
||||||
start = (0 == strncmp("0x", line, 2)) ? 2 : 0;
|
start = (0 == strncmp("0x", line, 2)) ? 2 : 0;
|
||||||
if (sscanf(line + start, "%8x %n%*x", &addr, &tmp) >= 1) {
|
found = sscanf(line + start, "%8x %n%*x", &addr, &tmp);
|
||||||
start += tmp;
|
if (found < 1)
|
||||||
for (len = strlen(line) - 1; NULL != strchr("\r\n", line[len]); --len)
|
continue;
|
||||||
line[len] = 0;
|
start += tmp;
|
||||||
if (!str2msr(line + start, &mf)) {
|
for (len = strlen(line) - 1; NULL != strchr("\r\n", line[len]); --len)
|
||||||
fprintf(stderr, "%s:%d: invalid MSR value '%s'\n", difffn, linenum, line + start);
|
line[len] = 0;
|
||||||
continue;
|
if (!str2msr(line + start, &mf)) {
|
||||||
}
|
fprintf(stderr, "%s:%d: invalid MSR value '%s'\n", difffn, linenum, line + start);
|
||||||
if (!sys->rdmsr(cpu, addr, &mhw))
|
continue;
|
||||||
goto done;
|
|
||||||
if (diff_msr(fout, addr, rev ? mhw : mf, rev ? mf : mhw))
|
|
||||||
fprintf(fout, "\n");
|
|
||||||
}
|
}
|
||||||
|
if (!sys->rdmsr(cpu, addr, &mhw))
|
||||||
|
goto done;
|
||||||
|
if (diff_msr(fout, addr, rev ? mhw : mf, rev ? mf : mhw))
|
||||||
|
fprintf(fout, "\n");
|
||||||
}
|
}
|
||||||
if (!feof(fin))
|
if (!feof(fin))
|
||||||
fprintf(stderr, "%s:%d: fgets: %s\n", difffn, linenum, strerror(errno));
|
fprintf(stderr, "%s:%d: fgets: %s\n", difffn, linenum, strerror(errno));
|
||||||
|
|
Loading…
Reference in New Issue