summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-03-04 18:13:14 +0100
committerRichard Braun <rbraun@sceen.net>2017-03-04 18:13:14 +0100
commit9ed05f3ef371e569eafd49c0924fea2499f5f6fe (patch)
treefaa4444b128b770bf4592104d1ffbd1b3f36172e
parent3e2e232b5308b1365e66bf664d9562455d6cad1b (diff)
Add missing braces for one-line blocks
-rw-r--r--arch/x86/machine/boot.c4
-rw-r--r--arch/x86/machine/cpu.c3
-rw-r--r--arch/x86/machine/string.c4
-rw-r--r--kern/assert.h3
-rw-r--r--kern/kmem.c3
-rw-r--r--kern/rbtree.h12
-rw-r--r--kern/thread.c3
7 files changed, 20 insertions, 12 deletions
diff --git a/arch/x86/machine/boot.c b/arch/x86/machine/boot.c
index 2ab1c6d..36eba21 100644
--- a/arch/x86/machine/boot.c
+++ b/arch/x86/machine/boot.c
@@ -412,10 +412,10 @@ boot_save_data(void)
{
boot_mbi.flags = boot_raw_mbi.flags;
- if (boot_mbi.flags & MULTIBOOT_LOADER_CMDLINE)
+ if (boot_mbi.flags & MULTIBOOT_LOADER_CMDLINE) {
boot_mbi.cmdline = boot_save_memory(boot_raw_mbi.cmdline,
boot_raw_mbi.unused0);
- else {
+ } else {
boot_mbi.cmdline = NULL;
}
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c
index 1928212..9bb593d 100644
--- a/arch/x86/machine/cpu.c
+++ b/arch/x86/machine/cpu.c
@@ -551,9 +551,10 @@ cpu_info(const struct cpu *cpu)
printk("cpu%u: %s\n", cpu->id, cpu->model_name);
}
- if ((cpu->phys_addr_width != 0) && (cpu->virt_addr_width != 0))
+ if ((cpu->phys_addr_width != 0) && (cpu->virt_addr_width != 0)) {
printk("cpu%u: address widths: physical: %hu, virtual: %hu\n",
cpu->id, cpu->phys_addr_width, cpu->virt_addr_width);
+ }
}
void __init
diff --git a/arch/x86/machine/string.c b/arch/x86/machine/string.c
index cdf00e3..10d9ee0 100644
--- a/arch/x86/machine/string.c
+++ b/arch/x86/machine/string.c
@@ -42,11 +42,11 @@ memmove(void *dest, const void *src, size_t n)
orig_dest = dest;
- if (dest <= src)
+ if (dest <= src) {
asm volatile("rep movsb"
: "+D" (dest), "+S" (src), "+c" (n)
: : "memory");
- else {
+ } else {
dest += n - 1;
src += n - 1;
asm volatile("std; rep movsb; cld"
diff --git a/kern/assert.h b/kern/assert.h
index d0fd08a..7c06f6a 100644
--- a/kern/assert.h
+++ b/kern/assert.h
@@ -30,9 +30,10 @@
*/
#define assert(expression) \
MACRO_BEGIN \
- if (unlikely(!(expression))) \
+ if (unlikely(!(expression))) { \
panic("assertion (%s) failed in %s:%d, function %s()", \
__QUOTE(expression), __FILE__, __LINE__, __func__); \
+ } \
MACRO_END
#endif /* NDEBUG */
diff --git a/kern/kmem.c b/kern/kmem.c
index f978088..d9ca7e4 100644
--- a/kern/kmem.c
+++ b/kern/kmem.c
@@ -168,10 +168,11 @@ kmem_buf_verify_bytes(void *buf, void *pattern, size_t size)
end = buf + size;
- for (ptr = buf, pattern_ptr = pattern; ptr < end; ptr++, pattern_ptr++)
+ for (ptr = buf, pattern_ptr = pattern; ptr < end; ptr++, pattern_ptr++) {
if (*ptr != *pattern_ptr) {
return ptr;
}
+ }
return NULL;
}
diff --git a/kern/rbtree.h b/kern/rbtree.h
index 02a657c..3808342 100644
--- a/kern/rbtree.h
+++ b/kern/rbtree.h
@@ -120,8 +120,9 @@ MACRO_BEGIN \
while (___cur != NULL) { \
___diff = cmp_fn(key, ___cur); \
\
- if (___diff == 0) \
+ if (___diff == 0) { \
break; \
+ } \
\
___cur = ___cur->children[rbtree_d2i(___diff)]; \
} \
@@ -151,16 +152,18 @@ MACRO_BEGIN \
while (___cur != NULL) { \
___diff = cmp_fn(key, ___cur); \
\
- if (___diff == 0) \
+ if (___diff == 0) { \
break; \
+ } \
\
___prev = ___cur; \
___index = rbtree_d2i(___diff); \
___cur = ___cur->children[___index]; \
} \
\
- if (___cur == NULL) \
+ if (___cur == NULL) { \
___cur = rbtree_nearest(___prev, ___index, dir); \
+ } \
\
___cur; \
MACRO_END
@@ -224,8 +227,9 @@ MACRO_BEGIN \
while (___cur != NULL) { \
___diff = cmp_fn(key, ___cur); \
\
- if (___diff == 0) \
+ if (___diff == 0) { \
break; \
+ } \
\
___prev = ___cur; \
___index = rbtree_d2i(___diff); \
diff --git a/kern/thread.c b/kern/thread.c
index 14070d9..da61ed6 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1405,10 +1405,11 @@ thread_sched_fs_balance_migrate(struct thread_runq *runq,
* Threads in the expired queue of a processor in round highest are
* actually in round highest + 1.
*/
- if (remote_runq->fs_round != highest_round)
+ if (remote_runq->fs_round != highest_round) {
nr_pulls = thread_sched_fs_balance_pull(runq, remote_runq,
remote_runq->fs_runq_expired,
nr_pulls);
+ }
out:
return nr_pulls;