diff options
author | Lee Leahy <leroy.p.leahy@intel.com> | 2017-03-08 17:37:06 -0800 |
---|---|---|
committer | Lee Leahy <leroy.p.leahy@intel.com> | 2017-03-09 17:29:33 +0100 |
commit | 2f919ec4765e4484d79b866332fa19ec338db5c0 (patch) | |
tree | 1ddb3a7eba06bdd40657c5f63bc8dce322c530a6 /src | |
parent | b2d834a93afe129851f9aa7400f3fb2f42be20a4 (diff) |
src/lib: Remove braces for single statements
Fix the following warning detected by checkpatch.pl:
WARNING: braces {} are not necessary for single statement blocks
TEST=Build and run on Galileo Gen2
Change-Id: Ie4b41f6fb75142ddd75103a55e0347ed85e7e873
Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com>
Reviewed-on: https://review.coreboot.org/18697
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/compute_ip_checksum.c | 9 | ||||
-rw-r--r-- | src/lib/coreboot_table.c | 9 | ||||
-rw-r--r-- | src/lib/delay.c | 6 | ||||
-rw-r--r-- | src/lib/edid.c | 15 | ||||
-rw-r--r-- | src/lib/gcov-glue.c | 3 | ||||
-rw-r--r-- | src/lib/generic_dump_spd.c | 3 | ||||
-rw-r--r-- | src/lib/halt.c | 3 | ||||
-rw-r--r-- | src/lib/jpeg.c | 9 | ||||
-rw-r--r-- | src/lib/memmove.c | 6 | ||||
-rw-r--r-- | src/lib/thread.c | 6 |
10 files changed, 23 insertions, 46 deletions
diff --git a/src/lib/compute_ip_checksum.c b/src/lib/compute_ip_checksum.c index 347b83f220..9bd3e0a2cb 100644 --- a/src/lib/compute_ip_checksum.c +++ b/src/lib/compute_ip_checksum.c @@ -18,15 +18,13 @@ unsigned long compute_ip_checksum(const void *addr, unsigned long length) for(i = 0; i < length; i++) { unsigned long v; v = ptr[i]; - if (i & 1) { + if (i & 1) v <<= 8; - } /* Add the new value */ sum += v; /* Wrap around the carry */ - if (sum > 0xFFFF) { + if (sum > 0xFFFF) sum = (sum + (sum >> 16)) & 0xFFFF; - } } value.byte[0] = sum & 0xff; value.byte[1] = (sum >> 8) & 0xff; @@ -46,8 +44,7 @@ unsigned long add_ip_checksums(unsigned long offset, unsigned long sum, unsigned new = ((new >> 8) & 0xff) | ((new << 8) & 0xff00); } checksum = sum + new; - if (checksum > 0xFFFF) { + if (checksum > 0xFFFF) checksum -= 0xFFFF; - } return (~checksum) & 0xFFFF; } diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 59f061b88f..e25a498f06 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -87,9 +87,8 @@ struct lb_record *lb_new_record(struct lb_header *header) { struct lb_record *rec; rec = lb_last_record(header); - if (header->table_entries) { + if (header->table_entries) header->table_bytes += rec->size; - } rec = lb_last_record(header); header->table_entries++; rec->tag = LB_TAG_UNUSED; @@ -286,9 +285,8 @@ static void lb_boot_media_params(struct lb_header *header) bmp->boot_media_size = region_device_sz(boot_dev); bmp->fmap_offset = ~(uint64_t)0; - if (find_fmap_directory(&fmrd) == 0) { + if (find_fmap_directory(&fmrd) == 0) bmp->fmap_offset = region_device_offset(&fmrd); - } } static void lb_ram_code(struct lb_header *header) @@ -443,9 +441,8 @@ static unsigned long lb_table_fini(struct lb_header *head) { struct lb_record *rec, *first_rec; rec = lb_last_record(head); - if (head->table_entries) { + if (head->table_entries) head->table_bytes += rec->size; - } first_rec = lb_first_record(head); head->table_checksum = compute_ip_checksum(first_rec, head->table_bytes); diff --git a/src/lib/delay.c b/src/lib/delay.c index f9703cb05a..5c0916f349 100644 --- a/src/lib/delay.c +++ b/src/lib/delay.c @@ -2,14 +2,12 @@ void mdelay(unsigned int msecs) { unsigned int i; - for(i = 0; i < msecs; i++) { + for(i = 0; i < msecs; i++) udelay(1000); - } } void delay(unsigned int secs) { unsigned int i; - for(i = 0; i < secs; i++) { + for(i = 0; i < secs; i++) mdelay(1000); - } } diff --git a/src/lib/edid.c b/src/lib/edid.c index d1b9c9fc47..4fb361aa0f 100644 --- a/src/lib/edid.c +++ b/src/lib/edid.c @@ -296,15 +296,13 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension, if (c->claims_one_point_four) { if (x[4] & 0x02) { v_max_offset = 255; - if (x[4] & 0x01) { + if (x[4] & 0x01) v_min_offset = 255; - } } if (x[4] & 0x04) { h_max_offset = 255; - if (x[4] & 0x03) { + if (x[4] & 0x03) h_min_offset = 255; - } } } else if (x[4]) { c->has_valid_range_descriptor = 0; @@ -446,9 +444,8 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension, } } - if (c->seen_non_detailed_descriptor && !in_extension) { + if (c->seen_non_detailed_descriptor && !in_extension) c->has_valid_descriptor_ordering = 0; - } /* Edid contains pixel clock in terms of 10KHz */ out->mode.pixel_clock = (x[0] + (x[1] << 8)) * 10; @@ -871,9 +868,8 @@ parse_cea(struct edid *out, unsigned char *x, struct edid_context *c) } else if (version == 3) { int i; printk(BIOS_SPEW, "%d bytes of CEA data\n", offset - 4); - for (i = 4; i < offset; i += (x[i] & 0x1f) + 1) { + for (i = 4; i < offset; i += (x[i] & 0x1f) + 1) cea_block(out, x + i); - } } if (version >= 2) { @@ -1156,9 +1152,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out) extra_info.type = edid[0x14] & 0x0f; } else if (c.claims_one_point_two) { conformance_mask = 0x7E; - if (edid[0x14] & 0x01) { + if (edid[0x14] & 0x01) printk(BIOS_SPEW, "DFP 1.x compatible TMDS\n"); - } } else conformance_mask = 0x7F; diff --git a/src/lib/gcov-glue.c b/src/lib/gcov-glue.c index d200cd2d98..d5e5584e87 100644 --- a/src/lib/gcov-glue.c +++ b/src/lib/gcov-glue.c @@ -134,9 +134,8 @@ static void coverage_init(void *unused) if (ctor == NULL) return; - for (; *ctor != (func_ptr) 0; ctor++) { + for (; *ctor != (func_ptr) 0; ctor++) (*ctor)(); - } } void __gcov_flush(void); diff --git a/src/lib/generic_dump_spd.c b/src/lib/generic_dump_spd.c index 7f81b3260f..f18bfa627e 100644 --- a/src/lib/generic_dump_spd.c +++ b/src/lib/generic_dump_spd.c @@ -62,9 +62,8 @@ void dump_spd_registers(void) printk(BIOS_DEBUG, "dimm %02x", device); for(i = 0; (i < 256) && (status == 0); i++) { unsigned int char byte; - if ((i % 20) == 0) { + if ((i % 20) == 0) printk(BIOS_DEBUG, "\n%3d: ", i); - } status = smbus_read_byte(device, i, &byte); if (status != 0) { printk(BIOS_DEBUG, "bad device\n"); diff --git a/src/lib/halt.c b/src/lib/halt.c index 8482ef9c45..40232c0ba4 100644 --- a/src/lib/halt.c +++ b/src/lib/halt.c @@ -18,7 +18,6 @@ #include <halt.h> void halt(void) { - while (1) { + while (1) hlt(); - } } diff --git a/src/lib/jpeg.c b/src/lib/jpeg.c index 9dc5e135c2..e6626b8131 100644 --- a/src/lib/jpeg.c +++ b/src/lib/jpeg.c @@ -931,9 +931,8 @@ static void col221111(int *out, unsigned char *pic, int width) outc = out + 64 * 4; for (i = 2; i > 0; i--) { for (j = 4; j > 0; j--) { - for (k = 0; k < 8; k++) { + for (k = 0; k < 8; k++) PIC221111(k); - } outc += 8; outy += 16; pic0 += 2 * width; @@ -956,9 +955,8 @@ static void col221111_16(int *out, unsigned char *pic, int width) outc = out + 64 * 4; for (i = 2; i > 0; i--) { for (j = 4; j > 0; j--) { - for (k = 0; k < 8; k++) { + for (k = 0; k < 8; k++) PIC221111_16(k); - } outc += 8; outy += 16; pic0 += 2 * width; @@ -981,9 +979,8 @@ static void col221111_32(int *out, unsigned char *pic, int width) outc = out + 64 * 4; for (i = 2; i > 0; i--) { for (j = 4; j > 0; j--) { - for (k = 0; k < 8; k++) { + for (k = 0; k < 8; k++) PIC221111_32(k); - } outc += 8; outy += 16; pic0 += 2 * width; diff --git a/src/lib/memmove.c b/src/lib/memmove.c index 241917c400..6a43ed4528 100644 --- a/src/lib/memmove.c +++ b/src/lib/memmove.c @@ -5,15 +5,13 @@ void *memmove(void *vdest, const void *vsrc, size_t count) char *dest = vdest; if (dest <= src) { - while (count--) { + while (count--) *dest++ = *src++; - } } else { src += count - 1; dest += count - 1; - while(count--) { + while(count--) *dest-- = *src--; - } } return vdest; } diff --git a/src/lib/thread.c b/src/lib/thread.c index c2504823b9..9387b037dd 100644 --- a/src/lib/thread.c +++ b/src/lib/thread.c @@ -121,9 +121,8 @@ static void idle_thread(void *unused) { /* This thread never voluntarily yields. */ thread_prevent_coop(); - while (1) { + while (1) timers_run(); - } } static void schedule(struct thread *t) @@ -214,9 +213,8 @@ static void idle_thread_init(void) t = get_free_thread(); - if (t == NULL) { + if (t == NULL) die("No threads available for idle thread!\n"); - } /* Queue idle thread to run once all other threads have yielded. */ prepare_thread(t, idle_thread, NULL, call_wrapper, NULL); |