public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: <linux-kernel@vger.kernel.org>
Cc: Tejun Heo <tj@kernel.org>, Arjan van de Ven <arjan@infradead.org>
Subject: [PATCH] async: fix compiler warning in initcall_debug code
Date: Sun, 27 Mar 2011 14:45:08 +0400	[thread overview]
Message-ID: <20110327104508.28272.97614.stgit@localhost6> (raw)

Fix compiler warning about uninitialized ktime_t variable:

CC      kernel/async.o
kernel/async.c: In function ‘async_synchronize_cookie_domain’:
kernel/async.c:270:10: warning: ‘starttime.tv64’ may be used uninitialized in this function
kernel/async.c: In function ‘async_run_entry_fn’:
kernel/async.c:122:10: warning: ‘calltime.tv64’ may be used uninitialized in this function

It always initialized before usage bacause initcall_debug cannot be turned off.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
---
 kernel/async.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/kernel/async.c b/kernel/async.c
index cd9dbb9..3d8220a 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -119,7 +119,7 @@ static void async_run_entry_fn(struct work_struct *work)
 	struct async_entry *entry =
 		container_of(work, struct async_entry, work);
 	unsigned long flags;
-	ktime_t calltime, delta, rettime;
+	ktime_t uninitialized_var(time);
 
 	/* 1) move self to the running queue */
 	spin_lock_irqsave(&async_lock, flags);
@@ -130,16 +130,17 @@ static void async_run_entry_fn(struct work_struct *work)
 	if (initcall_debug && system_state == SYSTEM_BOOTING) {
 		printk("calling  %lli_%pF @ %i\n", (long long)entry->cookie,
 			entry->func, task_pid_nr(current));
-		calltime = ktime_get();
+		time = ktime_get();
 	}
+
 	entry->func(entry->data, entry->cookie);
+
 	if (initcall_debug && system_state == SYSTEM_BOOTING) {
-		rettime = ktime_get();
-		delta = ktime_sub(rettime, calltime);
+		time = ktime_sub(ktime_get(), time);
 		printk("initcall %lli_%pF returned 0 after %lld usecs\n",
 			(long long)entry->cookie,
 			entry->func,
-			(long long)ktime_to_ns(delta) >> 10);
+			(long long)ktime_to_ns(time) >> 10);
 	}
 
 	/* 3) remove self from the running queue */
@@ -267,22 +268,20 @@ EXPORT_SYMBOL_GPL(async_synchronize_full_domain);
 void async_synchronize_cookie_domain(async_cookie_t cookie,
 				     struct list_head *running)
 {
-	ktime_t starttime, delta, endtime;
+	ktime_t uninitialized_var(time);
 
 	if (initcall_debug && system_state == SYSTEM_BOOTING) {
 		printk("async_waiting @ %i\n", task_pid_nr(current));
-		starttime = ktime_get();
+		time = ktime_get();
 	}
 
 	wait_event(async_done, lowest_in_progress(running) >= cookie);
 
 	if (initcall_debug && system_state == SYSTEM_BOOTING) {
-		endtime = ktime_get();
-		delta = ktime_sub(endtime, starttime);
-
+		time = ktime_sub(ktime_get(), time);
 		printk("async_continuing @ %i after %lli usec\n",
 			task_pid_nr(current),
-			(long long)ktime_to_ns(delta) >> 10);
+			(long long)ktime_to_ns(time) >> 10);
 	}
 }
 EXPORT_SYMBOL_GPL(async_synchronize_cookie_domain);


                 reply	other threads:[~2011-03-27 10:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110327104508.28272.97614.stgit@localhost6 \
    --to=khlebnikov@openvz.org \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox