Commit e662e1cf authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Linus Torvalds

init: don't lose initcall return values

There is an ability to lose an initcall return value if it happened with irq
disabled or imbalanced preemption (and if we debug initcall).
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 67d76710
...@@ -702,7 +702,6 @@ static void __init do_initcalls(void) ...@@ -702,7 +702,6 @@ static void __init do_initcalls(void)
for (call = __initcall_start; call < __initcall_end; call++) { for (call = __initcall_start; call < __initcall_end; call++) {
ktime_t t0, t1, delta; ktime_t t0, t1, delta;
char *msg = NULL;
char msgbuf[40]; char msgbuf[40];
int result; int result;
...@@ -724,22 +723,23 @@ static void __init do_initcalls(void) ...@@ -724,22 +723,23 @@ static void __init do_initcalls(void)
(unsigned long long) delta.tv64 >> 20); (unsigned long long) delta.tv64 >> 20);
} }
if (result && result != -ENODEV && initcall_debug) { msgbuf[0] = 0;
sprintf(msgbuf, "error code %d", result);
msg = msgbuf; if (result && result != -ENODEV && initcall_debug)
} sprintf(msgbuf, "error code %d ", result);
if (preempt_count() != count) { if (preempt_count() != count) {
msg = "preemption imbalance"; strncat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
preempt_count() = count; preempt_count() = count;
} }
if (irqs_disabled()) { if (irqs_disabled()) {
msg = "disabled interrupts"; strncat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
local_irq_enable(); local_irq_enable();
} }
if (msg) { if (msgbuf[0]) {
print_fn_descriptor_symbol(KERN_WARNING "initcall %s()", print_fn_descriptor_symbol(KERN_WARNING "initcall %s()",
(unsigned long) *call); (unsigned long) *call);
printk(" returned with %s\n", msg); printk(" returned with %s\n", msgbuf);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment