diff options
Diffstat (limited to 'kernel/posix-cpu-timers.c')
-rw-r--r-- | kernel/posix-cpu-timers.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 92a038064628..b15462b17a58 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -730,9 +730,15 @@ int posix_cpu_timer_set(struct k_itimer *timer, int flags, | |||
730 | * Disarm any old timer after extracting its expiry time. | 730 | * Disarm any old timer after extracting its expiry time. |
731 | */ | 731 | */ |
732 | BUG_ON(!irqs_disabled()); | 732 | BUG_ON(!irqs_disabled()); |
733 | |||
734 | ret = 0; | ||
733 | spin_lock(&p->sighand->siglock); | 735 | spin_lock(&p->sighand->siglock); |
734 | old_expires = timer->it.cpu.expires; | 736 | old_expires = timer->it.cpu.expires; |
735 | list_del_init(&timer->it.cpu.entry); | 737 | if (unlikely(timer->it.cpu.firing)) { |
738 | timer->it.cpu.firing = -1; | ||
739 | ret = TIMER_RETRY; | ||
740 | } else | ||
741 | list_del_init(&timer->it.cpu.entry); | ||
736 | spin_unlock(&p->sighand->siglock); | 742 | spin_unlock(&p->sighand->siglock); |
737 | 743 | ||
738 | /* | 744 | /* |
@@ -780,7 +786,7 @@ int posix_cpu_timer_set(struct k_itimer *timer, int flags, | |||
780 | } | 786 | } |
781 | } | 787 | } |
782 | 788 | ||
783 | if (unlikely(timer->it.cpu.firing)) { | 789 | if (unlikely(ret)) { |
784 | /* | 790 | /* |
785 | * We are colliding with the timer actually firing. | 791 | * We are colliding with the timer actually firing. |
786 | * Punt after filling in the timer's old value, and | 792 | * Punt after filling in the timer's old value, and |
@@ -788,8 +794,6 @@ int posix_cpu_timer_set(struct k_itimer *timer, int flags, | |||
788 | * it as an overrun (thanks to bump_cpu_timer above). | 794 | * it as an overrun (thanks to bump_cpu_timer above). |
789 | */ | 795 | */ |
790 | read_unlock(&tasklist_lock); | 796 | read_unlock(&tasklist_lock); |
791 | timer->it.cpu.firing = -1; | ||
792 | ret = TIMER_RETRY; | ||
793 | goto out; | 797 | goto out; |
794 | } | 798 | } |
795 | 799 | ||