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 <zhan...@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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to