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