lkml.org 
[lkml]   [2014]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] timekeeping: check params before use them
Date
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@marvell.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


\
 
 \ /
  Last update: 2014-03-27 09:41    [W:0.034 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site