diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2017-05-30 17:15:51 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2017-06-04 09:40:28 -0400 |
| commit | eabdec04385376d560078992710104cc7be2ce1b (patch) | |
| tree | ca24f482991666b523d9d0e4b11d3cdad304c676 /kernel/time | |
| parent | 91d57bae08689199c8acc77a8b3b41150cafab1c (diff) | |
posix-timers: Zero settings value in common code
Zero out the settings struct in the common code so the callbacks do not
have to do it themself.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/20170530211657.200870713@linutronix.de
Diffstat (limited to 'kernel/time')
| -rw-r--r-- | kernel/time/posix-cpu-timers.c | 5 | ||||
| -rw-r--r-- | kernel/time/posix-timers.c | 3 |
2 files changed, 2 insertions, 6 deletions
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c index 96c833a61ade..cb4a4eb44279 100644 --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c | |||
| @@ -719,10 +719,8 @@ static void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec64 *itp | |||
| 719 | */ | 719 | */ |
| 720 | itp->it_interval = ns_to_timespec64(timer->it.cpu.incr); | 720 | itp->it_interval = ns_to_timespec64(timer->it.cpu.incr); |
| 721 | 721 | ||
| 722 | if (timer->it.cpu.expires == 0) { /* Timer not armed at all. */ | 722 | if (!timer->it.cpu.expires) |
| 723 | itp->it_value.tv_sec = itp->it_value.tv_nsec = 0; | ||
| 724 | return; | 723 | return; |
| 725 | } | ||
| 726 | 724 | ||
| 727 | /* | 725 | /* |
| 728 | * Sample the clock to take the difference with the expiry time. | 726 | * Sample the clock to take the difference with the expiry time. |
| @@ -746,7 +744,6 @@ static void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec64 *itp | |||
| 746 | * Call the timer disarmed, nothing else to do. | 744 | * Call the timer disarmed, nothing else to do. |
| 747 | */ | 745 | */ |
| 748 | timer->it.cpu.expires = 0; | 746 | timer->it.cpu.expires = 0; |
| 749 | itp->it_value = ns_to_timespec64(timer->it.cpu.expires); | ||
| 750 | return; | 747 | return; |
| 751 | } else { | 748 | } else { |
| 752 | cpu_timer_sample_group(timer->it_clock, p, &now); | 749 | cpu_timer_sample_group(timer->it_clock, p, &now); |
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 48f6c37ae5df..0332f7a60fd6 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c | |||
| @@ -645,8 +645,6 @@ common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting) | |||
| 645 | struct timespec64 ts64; | 645 | struct timespec64 ts64; |
| 646 | bool sig_none; | 646 | bool sig_none; |
| 647 | 647 | ||
| 648 | memset(cur_setting, 0, sizeof(*cur_setting)); | ||
| 649 | |||
| 650 | sig_none = (timr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE; | 648 | sig_none = (timr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE; |
| 651 | iv = timr->it_interval; | 649 | iv = timr->it_interval; |
| 652 | 650 | ||
| @@ -705,6 +703,7 @@ SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, | |||
| 705 | if (!timr) | 703 | if (!timr) |
| 706 | return -EINVAL; | 704 | return -EINVAL; |
| 707 | 705 | ||
| 706 | memset(&cur_setting64, 0, sizeof(cur_setting64)); | ||
| 708 | kc = timr->kclock; | 707 | kc = timr->kclock; |
| 709 | if (WARN_ON_ONCE(!kc || !kc->timer_get)) | 708 | if (WARN_ON_ONCE(!kc || !kc->timer_get)) |
| 710 | ret = -EINVAL; | 709 | ret = -EINVAL; |
