All of lore.kernel.org
 help / color / mirror / Atom feed
* + init-mainc-fix-warning-calltimetv64-may-be-used-uninitialized.patch added to -mm tree
@ 2010-07-08  0:18 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2010-07-08  0:18 UTC (permalink / raw)
  To: mm-commits; +Cc: kjwinchester, mingo, rusty


The patch titled
     init/main.c: fix warning: 'calltime.tv64' may be used uninitialized
has been added to the -mm tree.  Its filename is
     init-mainc-fix-warning-calltimetv64-may-be-used-uninitialized.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: init/main.c: fix warning: 'calltime.tv64' may be used uninitialized
From: Kevin Winchester <kjwinchester@gmail.com>

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>
---

 init/main.c |   34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff -puN init/main.c~init-mainc-fix-warning-calltimetv64-may-be-used-uninitialized init/main.c
--- a/init/main.c~init-mainc-fix-warning-calltimetv64-may-be-used-uninitialized
+++ a/init/main.c
@@ -724,27 +724,33 @@ core_param(initcall_debug, initcall_debu
 
 static char msgbuf[64];
 
-int do_one_initcall(initcall_t fn)
+static int do_one_initcall_debug(initcall_t fn)
 {
-	int count = preempt_count();
 	ktime_t calltime, delta, rettime;
 	unsigned long long duration;
 	int ret;
 
-	if (initcall_debug) {
-		printk("calling  %pF @ %i\n", fn, task_pid_nr(current));
-		calltime = ktime_get();
-	}
-
+	printk(KERN_DEBUG "calling  %pF @ %i\n", fn, task_pid_nr(current));
+	calltime = ktime_get();
 	ret = fn();
+	rettime = ktime_get();
+	delta = ktime_sub(rettime, calltime);
+	duration = (unsigned long long) ktime_to_ns(delta) >> 10;
+	printk(KERN_DEBUG "initcall %pF returned %d after %lld usecs\n", fn,
+		ret, duration);
 
-	if (initcall_debug) {
-		rettime = ktime_get();
-		delta = ktime_sub(rettime, calltime);
-		duration = (unsigned long long) ktime_to_ns(delta) >> 10;
-		printk("initcall %pF returned %d after %lld usecs\n", fn,
-			ret, duration);
-	}
+	return ret;
+}
+
+int do_one_initcall(initcall_t fn)
+{
+	int count = preempt_count();
+	int ret;
+
+	if (initcall_debug)
+		ret = do_one_initcall_debug(fn);
+	else
+		ret = fn();
 
 	msgbuf[0] = 0;
 
_

Patches currently in -mm which might be from kjwinchester@gmail.com are

linux-next.patch
init-mainc-fix-warning-calltimetv64-may-be-used-uninitialized.patch
init-mainc-mark-do_one_initcall-as-__init_or_module.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-08  0:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-08  0:18 + init-mainc-fix-warning-calltimetv64-may-be-used-uninitialized.patch added to -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.