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)
This commit is contained in:
Lee Leahy 2017-03-08 17:37:06 -08:00
parent b2d834a93a
commit 2f919ec476
10 changed files with 23 additions and 46 deletions

View File

@ -18,15 +18,13 @@ unsigned long compute_ip_checksum(const void *addr, unsigned long length)
for(i = 0; i < length; i++) { for(i = 0; i < length; i++) {
unsigned long v; unsigned long v;
v = ptr[i]; v = ptr[i];
if (i & 1) { if (i & 1)
v <<= 8; v <<= 8;
}
/* Add the new value */ /* Add the new value */
sum += v; sum += v;
/* Wrap around the carry */ /* Wrap around the carry */
if (sum > 0xFFFF) { if (sum > 0xFFFF)
sum = (sum + (sum >> 16)) & 0xFFFF; sum = (sum + (sum >> 16)) & 0xFFFF;
}
} }
value.byte[0] = sum & 0xff; value.byte[0] = sum & 0xff;
value.byte[1] = (sum >> 8) & 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); new = ((new >> 8) & 0xff) | ((new << 8) & 0xff00);
} }
checksum = sum + new; checksum = sum + new;
if (checksum > 0xFFFF) { if (checksum > 0xFFFF)
checksum -= 0xFFFF; checksum -= 0xFFFF;
}
return (~checksum) & 0xFFFF; return (~checksum) & 0xFFFF;
} }

View File

@ -87,9 +87,8 @@ struct lb_record *lb_new_record(struct lb_header *header)
{ {
struct lb_record *rec; struct lb_record *rec;
rec = lb_last_record(header); rec = lb_last_record(header);
if (header->table_entries) { if (header->table_entries)
header->table_bytes += rec->size; header->table_bytes += rec->size;
}
rec = lb_last_record(header); rec = lb_last_record(header);
header->table_entries++; header->table_entries++;
rec->tag = LB_TAG_UNUSED; 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->boot_media_size = region_device_sz(boot_dev);
bmp->fmap_offset = ~(uint64_t)0; 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); bmp->fmap_offset = region_device_offset(&fmrd);
}
} }
static void lb_ram_code(struct lb_header *header) 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; struct lb_record *rec, *first_rec;
rec = lb_last_record(head); rec = lb_last_record(head);
if (head->table_entries) { if (head->table_entries)
head->table_bytes += rec->size; head->table_bytes += rec->size;
}
first_rec = lb_first_record(head); first_rec = lb_first_record(head);
head->table_checksum = compute_ip_checksum(first_rec, head->table_bytes); head->table_checksum = compute_ip_checksum(first_rec, head->table_bytes);

View File

@ -2,14 +2,12 @@
void mdelay(unsigned int msecs) void mdelay(unsigned int msecs)
{ {
unsigned int i; unsigned int i;
for(i = 0; i < msecs; i++) { for(i = 0; i < msecs; i++)
udelay(1000); udelay(1000);
}
} }
void delay(unsigned int secs) void delay(unsigned int secs)
{ {
unsigned int i; unsigned int i;
for(i = 0; i < secs; i++) { for(i = 0; i < secs; i++)
mdelay(1000); mdelay(1000);
}
} }

View File

@ -296,15 +296,13 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
if (c->claims_one_point_four) { if (c->claims_one_point_four) {
if (x[4] & 0x02) { if (x[4] & 0x02) {
v_max_offset = 255; v_max_offset = 255;
if (x[4] & 0x01) { if (x[4] & 0x01)
v_min_offset = 255; v_min_offset = 255;
}
} }
if (x[4] & 0x04) { if (x[4] & 0x04) {
h_max_offset = 255; h_max_offset = 255;
if (x[4] & 0x03) { if (x[4] & 0x03)
h_min_offset = 255; h_min_offset = 255;
}
} }
} else if (x[4]) { } else if (x[4]) {
c->has_valid_range_descriptor = 0; 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; c->has_valid_descriptor_ordering = 0;
}
/* Edid contains pixel clock in terms of 10KHz */ /* Edid contains pixel clock in terms of 10KHz */
out->mode.pixel_clock = (x[0] + (x[1] << 8)) * 10; 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) { } else if (version == 3) {
int i; int i;
printk(BIOS_SPEW, "%d bytes of CEA data\n", offset - 4); 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); cea_block(out, x + i);
}
} }
if (version >= 2) { if (version >= 2) {
@ -1156,9 +1152,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
extra_info.type = edid[0x14] & 0x0f; extra_info.type = edid[0x14] & 0x0f;
} else if (c.claims_one_point_two) { } else if (c.claims_one_point_two) {
conformance_mask = 0x7E; conformance_mask = 0x7E;
if (edid[0x14] & 0x01) { if (edid[0x14] & 0x01)
printk(BIOS_SPEW, "DFP 1.x compatible TMDS\n"); printk(BIOS_SPEW, "DFP 1.x compatible TMDS\n");
}
} else } else
conformance_mask = 0x7F; conformance_mask = 0x7F;

View File

@ -134,9 +134,8 @@ static void coverage_init(void *unused)
if (ctor == NULL) if (ctor == NULL)
return; return;
for (; *ctor != (func_ptr) 0; ctor++) { for (; *ctor != (func_ptr) 0; ctor++)
(*ctor)(); (*ctor)();
}
} }
void __gcov_flush(void); void __gcov_flush(void);

View File

@ -62,9 +62,8 @@ void dump_spd_registers(void)
printk(BIOS_DEBUG, "dimm %02x", device); printk(BIOS_DEBUG, "dimm %02x", device);
for(i = 0; (i < 256) && (status == 0); i++) { for(i = 0; (i < 256) && (status == 0); i++) {
unsigned int char byte; unsigned int char byte;
if ((i % 20) == 0) { if ((i % 20) == 0)
printk(BIOS_DEBUG, "\n%3d: ", i); printk(BIOS_DEBUG, "\n%3d: ", i);
}
status = smbus_read_byte(device, i, &byte); status = smbus_read_byte(device, i, &byte);
if (status != 0) { if (status != 0) {
printk(BIOS_DEBUG, "bad device\n"); printk(BIOS_DEBUG, "bad device\n");

View File

@ -18,7 +18,6 @@
#include <halt.h> #include <halt.h>
void halt(void) { void halt(void) {
while (1) { while (1)
hlt(); hlt();
}
} }

View File

@ -931,9 +931,8 @@ static void col221111(int *out, unsigned char *pic, int width)
outc = out + 64 * 4; outc = out + 64 * 4;
for (i = 2; i > 0; i--) { for (i = 2; i > 0; i--) {
for (j = 4; j > 0; j--) { for (j = 4; j > 0; j--) {
for (k = 0; k < 8; k++) { for (k = 0; k < 8; k++)
PIC221111(k); PIC221111(k);
}
outc += 8; outc += 8;
outy += 16; outy += 16;
pic0 += 2 * width; pic0 += 2 * width;
@ -956,9 +955,8 @@ static void col221111_16(int *out, unsigned char *pic, int width)
outc = out + 64 * 4; outc = out + 64 * 4;
for (i = 2; i > 0; i--) { for (i = 2; i > 0; i--) {
for (j = 4; j > 0; j--) { for (j = 4; j > 0; j--) {
for (k = 0; k < 8; k++) { for (k = 0; k < 8; k++)
PIC221111_16(k); PIC221111_16(k);
}
outc += 8; outc += 8;
outy += 16; outy += 16;
pic0 += 2 * width; pic0 += 2 * width;
@ -981,9 +979,8 @@ static void col221111_32(int *out, unsigned char *pic, int width)
outc = out + 64 * 4; outc = out + 64 * 4;
for (i = 2; i > 0; i--) { for (i = 2; i > 0; i--) {
for (j = 4; j > 0; j--) { for (j = 4; j > 0; j--) {
for (k = 0; k < 8; k++) { for (k = 0; k < 8; k++)
PIC221111_32(k); PIC221111_32(k);
}
outc += 8; outc += 8;
outy += 16; outy += 16;
pic0 += 2 * width; pic0 += 2 * width;

View File

@ -5,15 +5,13 @@ void *memmove(void *vdest, const void *vsrc, size_t count)
char *dest = vdest; char *dest = vdest;
if (dest <= src) { if (dest <= src) {
while (count--) { while (count--)
*dest++ = *src++; *dest++ = *src++;
}
} else { } else {
src += count - 1; src += count - 1;
dest += count - 1; dest += count - 1;
while(count--) { while(count--)
*dest-- = *src--; *dest-- = *src--;
}
} }
return vdest; return vdest;
} }

View File

@ -121,9 +121,8 @@ static void idle_thread(void *unused)
{ {
/* This thread never voluntarily yields. */ /* This thread never voluntarily yields. */
thread_prevent_coop(); thread_prevent_coop();
while (1) { while (1)
timers_run(); timers_run();
}
} }
static void schedule(struct thread *t) static void schedule(struct thread *t)
@ -214,9 +213,8 @@ static void idle_thread_init(void)
t = get_free_thread(); t = get_free_thread();
if (t == NULL) { if (t == NULL)
die("No threads available for idle thread!\n"); die("No threads available for idle thread!\n");
}
/* Queue idle thread to run once all other threads have yielded. */ /* Queue idle thread to run once all other threads have yielded. */
prepare_thread(t, idle_thread, NULL, call_wrapper, NULL); prepare_thread(t, idle_thread, NULL, call_wrapper, NULL);