diff options
author | Kevin Winchester <kjwinchester@gmail.com> | 2010-08-09 20:20:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-09 23:45:06 -0400 |
commit | 22c5c03b42c082ab57b5d24824769ada0d90f8dc (patch) | |
tree | f3bb670ed467b05cba425e21625213de00dd9f0d /init | |
parent | 459b37d423104f00e87d1934821bc8739979d0e4 (diff) |
init/main.c: fix warning: 'calltime.tv64' may be used uninitialized
Using:
gcc (GCC) 4.5.0 20100610 (prerelease)
The following warning appears:
init/main.c: In function `do_one_initcall':
init/main.c:730:10: warning: `calltime.tv64' may be used uninitialized in this function
This warning is actually correct, as the global initcall_debug could
arguably be changed by the initcall.
Correct this warning by extracting a new function, do_one_initcall_debug,
that performs the initcall for the debug case.
Signed-off-by: Kevin Winchester <kjwinchester@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>
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 | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/init/main.c b/init/main.c index b8b6effe9ff4..dbee132923c5 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -721,27 +721,33 @@ core_param(initcall_debug, initcall_debug, bool, 0644); | |||
721 | 721 | ||
722 | static char msgbuf[64]; | 722 | static char msgbuf[64]; |
723 | 723 | ||
724 | int do_one_initcall(initcall_t fn) | 724 | static int do_one_initcall_debug(initcall_t fn) |
725 | { | 725 | { |
726 | int count = preempt_count(); | ||
727 | ktime_t calltime, delta, rettime; | 726 | ktime_t calltime, delta, rettime; |
728 | unsigned long long duration; | 727 | unsigned long long duration; |
729 | int ret; | 728 | int ret; |
730 | 729 | ||
731 | if (initcall_debug) { | 730 | printk(KERN_DEBUG "calling %pF @ %i\n", fn, task_pid_nr(current)); |
732 | printk("calling %pF @ %i\n", fn, task_pid_nr(current)); | 731 | calltime = ktime_get(); |
733 | calltime = ktime_get(); | ||
734 | } | ||
735 | |||
736 | ret = fn(); | 732 | ret = fn(); |
733 | rettime = ktime_get(); | ||
734 | delta = ktime_sub(rettime, calltime); | ||
735 | duration = (unsigned long long) ktime_to_ns(delta) >> 10; | ||
736 | printk(KERN_DEBUG "initcall %pF returned %d after %lld usecs\n", fn, | ||
737 | ret, duration); | ||
737 | 738 | ||
738 | if (initcall_debug) { | 739 | return ret; |
739 | rettime = ktime_get(); | 740 | } |
740 | delta = ktime_sub(rettime, calltime); | 741 | |
741 | duration = (unsigned long long) ktime_to_ns(delta) >> 10; | 742 | int do_one_initcall(initcall_t fn) |
742 | printk("initcall %pF returned %d after %lld usecs\n", fn, | 743 | { |
743 | ret, duration); | 744 | int count = preempt_count(); |
744 | } | 745 | int ret; |
746 | |||
747 | if (initcall_debug) | ||
748 | ret = do_one_initcall_debug(fn); | ||
749 | else | ||
750 | ret = fn(); | ||
745 | 751 | ||
746 | msgbuf[0] = 0; | 752 | msgbuf[0] = 0; |
747 | 753 | ||