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: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Cyrill Gorcunov and committed by Linus Torvalds e662e1cf 67d76710

+9 -9
+9 -9
init/main.c
··· 702 702 703 703 for (call = __initcall_start; call < __initcall_end; call++) { 704 704 ktime_t t0, t1, delta; 705 - char *msg = NULL; 706 705 char msgbuf[40]; 707 706 int result; 708 707 ··· 723 724 (unsigned long long) delta.tv64 >> 20); 724 725 } 725 726 726 - if (result && result != -ENODEV && initcall_debug) { 727 - sprintf(msgbuf, "error code %d", result); 728 - msg = msgbuf; 729 - } 727 + msgbuf[0] = 0; 728 + 729 + if (result && result != -ENODEV && initcall_debug) 730 + sprintf(msgbuf, "error code %d ", result); 731 + 730 732 if (preempt_count() != count) { 731 - msg = "preemption imbalance"; 733 + strncat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); 732 734 preempt_count() = count; 733 735 } 734 736 if (irqs_disabled()) { 735 - msg = "disabled interrupts"; 737 + strncat(msgbuf, "disabled interrupts ", sizeof(msgbuf)); 736 738 local_irq_enable(); 737 739 } 738 - if (msg) { 740 + if (msgbuf[0]) { 739 741 print_fn_descriptor_symbol(KERN_WARNING "initcall %s()", 740 742 (unsigned long) *call); 741 - printk(" returned with %s\n", msg); 743 + printk(" returned with %s\n", msgbuf); 742 744 } 743 745 } 744 746