[PATCH] initcall failure reporting

We presently ignore the return values from initcalls.  But that can carry
useful debugging information.  So print it out if it's non-zero.

It turns out the -ENODEV happens quite a lot, due to built-in drivers which
have no hardware to drive.  So suppress that unless initcall_debug was
specified.

Also make the warning message more friendly by printing the name of the
initcall function.

Also drop the KERN_DEBUG from the initcall_debug message.  If we specified
inticall_debug then we obviously want to see the messages.

Acked-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Andrew Morton 2006-03-25 03:07:15 -08:00 committed by Linus Torvalds
parent cd02b966bf
commit c1cda48af8
1 changed files with 15 additions and 7 deletions

View File

@ -571,17 +571,23 @@ static void __init do_initcalls(void)
int count = preempt_count(); int count = preempt_count();
for (call = __initcall_start; call < __initcall_end; call++) { for (call = __initcall_start; call < __initcall_end; call++) {
char *msg; char *msg = NULL;
char msgbuf[40];
int result;
if (initcall_debug) { if (initcall_debug) {
printk(KERN_DEBUG "Calling initcall 0x%p", *call); printk("Calling initcall 0x%p", *call);
print_fn_descriptor_symbol(": %s()", (unsigned long) *call); print_fn_descriptor_symbol(": %s()",
(unsigned long) *call);
printk("\n"); printk("\n");
} }
(*call)(); result = (*call)();
msg = NULL; if (result && (result != -ENODEV || initcall_debug)) {
sprintf(msgbuf, "error code %d", result);
msg = msgbuf;
}
if (preempt_count() != count) { if (preempt_count() != count) {
msg = "preemption imbalance"; msg = "preemption imbalance";
preempt_count() = count; preempt_count() = count;
@ -591,8 +597,10 @@ static void __init do_initcalls(void)
local_irq_enable(); local_irq_enable();
} }
if (msg) { if (msg) {
printk(KERN_WARNING "error in initcall at 0x%p: " printk(KERN_WARNING "initcall at 0x%p", *call);
"returned with %s\n", *call, msg); print_fn_descriptor_symbol(": %s()",
(unsigned long) *call);
printk(": returned with %s\n", msg);
} }
} }