src/lib: Move assignment out of if condition

Fix the following error detected by checkpatch:

ERROR: do not use assignment in if condition

TEST=Build and run on Galileo Gen2

Change-Id: I5a08d1647db66bd5d480f81e90d473999c222acf
Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com>
Reviewed-on: https://review.coreboot.org/18761
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Lee Leahy 2017-03-10 15:51:04 -08:00
parent 006d73d2e2
commit 491c5b60d0
2 changed files with 23 additions and 13 deletions

View File

@ -166,7 +166,8 @@ static int readtables(int till)
for (;;) { for (;;) {
if (getbyte() != 0xff) if (getbyte() != 0xff)
return -1; return -1;
if ((m = getbyte()) == till) m = getbyte();
if (m == till)
break; break;
switch (m) { switch (m) {
@ -455,15 +456,20 @@ static int fillbits(struct in *in, int le, unsigned int bi)
} }
while (le <= 24) { while (le <= 24) {
b = *in->p++; b = *in->p++;
if (b == 0xff && (m = *in->p++) != 0) { if (b == 0xff) {
if (m == M_EOF) { m = *in->p++;
if (in->func && (m = in->func(in->data)) == 0) if (m != 0) {
continue; if (m == M_EOF) {
if (in->func) {
m = in->func(in->data);
if (m == 0)
continue;
}
in->marker = m;
if (le <= 16)
bi = bi << 16, le += 16;
break;
} }
in->marker = m;
if (le <= 16)
bi = bi << 16, le += 16;
break;
} }
bi = bi << 8 | b; bi = bi << 8 | b;
le += 8; le += 8;
@ -477,7 +483,8 @@ static int dec_readmarker(struct in *in)
int m; int m;
in->left = fillbits(in, in->left, in->bits); in->left = fillbits(in, in->left, in->bits);
if ((m = in->marker) == 0) m = in->marker;
if (m == 0)
return 0; return 0;
in->left = 0; in->left = 0;
in->marker = 0; in->marker = 0;

View File

@ -496,7 +496,8 @@ gcov_exit(void)
if (length != GCOV_TAG_SUMMARY_LENGTH) if (length != GCOV_TAG_SUMMARY_LENGTH)
goto read_mismatch; goto read_mismatch;
gcov_read_summary(&tmp); gcov_read_summary(&tmp);
if ((error = gcov_is_error())) error = gcov_is_error();
if (error)
goto read_error; goto read_error;
if (summary_pos if (summary_pos
|| tmp.checksum != crc32) || tmp.checksum != crc32)
@ -584,7 +585,8 @@ gcov_exit(void)
ci_ptr->num); ci_ptr->num);
ci_ptr++; ci_ptr++;
} }
if ((error = gcov_is_error())) error = gcov_is_error();
if (error)
goto read_error; goto read_error;
} }
@ -713,7 +715,8 @@ read_fatal:;
fn_buffer = free_fn_data(gi_ptr, fn_buffer, fn_buffer = free_fn_data(gi_ptr, fn_buffer,
GCOV_COUNTERS); GCOV_COUNTERS);
if ((error = gcov_close())) error = gcov_close();
if (error)
fprintf(stderr, error < 0 ? fprintf(stderr, error < 0 ?
"profiling:%s:Overflow writing\n" : "profiling:%s:Overflow writing\n" :
"profiling:%s:Error writing\n", "profiling:%s:Error writing\n",