diff options
| author | Cyrill Gorcunov <gorcunov@gmail.com> | 2008-05-12 17:02:22 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-13 11:02:25 -0400 |
| commit | e662e1cfd434aa234b72fbc781f1d70211cb785b (patch) | |
| tree | f733af13c469b185ba4b4eb192f2834936200e9b /init | |
| parent | 67d7671036e6cae24ded112e079926d55ffe9580 (diff) | |
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>
Diffstat (limited to 'init')
| -rw-r--r-- | init/main.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/init/main.c b/init/main.c index ddada7acf363..f406fefa626c 100644 --- a/init/main.c +++ b/init/main.c | |||
| @@ -702,7 +702,6 @@ static void __init do_initcalls(void) | |||
| 702 | 702 | ||
| 703 | for (call = __initcall_start; call < __initcall_end; call++) { | 703 | for (call = __initcall_start; call < __initcall_end; call++) { |
| 704 | ktime_t t0, t1, delta; | 704 | ktime_t t0, t1, delta; |
| 705 | char *msg = NULL; | ||
| 706 | char msgbuf[40]; | 705 | char msgbuf[40]; |
| 707 | int result; | 706 | int result; |
| 708 | 707 | ||
| @@ -724,22 +723,23 @@ static void __init do_initcalls(void) | |||
| 724 | (unsigned long long) delta.tv64 >> 20); | 723 | (unsigned long long) delta.tv64 >> 20); |
| 725 | } | 724 | } |
| 726 | 725 | ||
| 727 | if (result && result != -ENODEV && initcall_debug) { | 726 | msgbuf[0] = 0; |
| 728 | sprintf(msgbuf, "error code %d", result); | 727 | |
| 729 | msg = msgbuf; | 728 | if (result && result != -ENODEV && initcall_debug) |
| 730 | } | 729 | sprintf(msgbuf, "error code %d ", result); |
| 730 | |||
| 731 | if (preempt_count() != count) { | 731 | if (preempt_count() != count) { |
| 732 | msg = "preemption imbalance"; | 732 | strncat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); |
| 733 | preempt_count() = count; | 733 | preempt_count() = count; |
| 734 | } | 734 | } |
| 735 | if (irqs_disabled()) { | 735 | if (irqs_disabled()) { |
| 736 | msg = "disabled interrupts"; | 736 | strncat(msgbuf, "disabled interrupts ", sizeof(msgbuf)); |
| 737 | local_irq_enable(); | 737 | local_irq_enable(); |
| 738 | } | 738 | } |
| 739 | if (msg) { | 739 | if (msgbuf[0]) { |
| 740 | print_fn_descriptor_symbol(KERN_WARNING "initcall %s()", | 740 | print_fn_descriptor_symbol(KERN_WARNING "initcall %s()", |
| 741 | (unsigned long) *call); | 741 | (unsigned long) *call); |
| 742 | printk(" returned with %s\n", msg); | 742 | printk(" returned with %s\n", msgbuf); |
| 743 | } | 743 | } |
| 744 | } | 744 | } |
| 745 | 745 | ||
