[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1395907978-6202-1-git-send-email-zhangwm@marvell.com>
Date: Thu, 27 Mar 2014 16:12:58 +0800
From: Neil Zhang <zhangwm@...vell.com>
To: <john.stultz@...aro.org>, <tglx@...utronix.de>
CC: <linux-kernel@...r.kernel.org>, Neil Zhang <zhangwm@...vell.com>
Subject: [PATCH] timekeeping: check params before use them
Sometimes we won't need all the information from
get_xtime_and_monotonic_and_sleep_offset(),
so let's check the params before assign the value to them.
Signed-off-by: Neil Zhang <zhangwm@...vell.com>
---
kernel/time/timekeeping.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 0aa4ce8..f0e8f53 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1598,9 +1598,12 @@ void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim,
do {
seq = read_seqcount_begin(&timekeeper_seq);
- *xtim = tk_xtime(tk);
- *wtom = tk->wall_to_monotonic;
- *sleep = tk->total_sleep_time;
+ if (xtim)
+ *xtim = tk_xtime(tk);
+ if (wtom)
+ *wtom = tk->wall_to_monotonic;
+ if (sleep)
+ *sleep = tk->total_sleep_time;
} while (read_seqcount_retry(&timekeeper_seq, seq));
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists