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++) {
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;
}

View File

@ -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);

View File

@ -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);
}
}

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 (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;

View File

@ -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);

View File

@ -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");

View File

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

View File

@ -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;

View File

@ -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;
}

View File

@ -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);