diff options
-rw-r--r-- | kernel/posix-timers.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index c459b29efdd4..7be385fe4eca 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -454,9 +454,8 @@ sys_timer_create(const clockid_t which_clock, | |||
454 | struct sigevent __user *timer_event_spec, | 454 | struct sigevent __user *timer_event_spec, |
455 | timer_t __user * created_timer_id) | 455 | timer_t __user * created_timer_id) |
456 | { | 456 | { |
457 | int error = 0; | ||
458 | struct k_itimer *new_timer; | 457 | struct k_itimer *new_timer; |
459 | int new_timer_id; | 458 | int error, new_timer_id; |
460 | struct task_struct *process; | 459 | struct task_struct *process; |
461 | sigevent_t event; | 460 | sigevent_t event; |
462 | int it_id_set = IT_ID_NOT_SET; | 461 | int it_id_set = IT_ID_NOT_SET; |
@@ -478,9 +477,9 @@ sys_timer_create(const clockid_t which_clock, | |||
478 | error = idr_get_new(&posix_timers_id, (void *) new_timer, | 477 | error = idr_get_new(&posix_timers_id, (void *) new_timer, |
479 | &new_timer_id); | 478 | &new_timer_id); |
480 | spin_unlock_irq(&idr_lock); | 479 | spin_unlock_irq(&idr_lock); |
481 | if (error == -EAGAIN) | 480 | if (error) { |
482 | goto retry; | 481 | if (error == -EAGAIN) |
483 | else if (error) { | 482 | goto retry; |
484 | /* | 483 | /* |
485 | * Weird looking, but we return EAGAIN if the IDR is | 484 | * Weird looking, but we return EAGAIN if the IDR is |
486 | * full (proper POSIX return value for this) | 485 | * full (proper POSIX return value for this) |
@@ -541,6 +540,8 @@ sys_timer_create(const clockid_t which_clock, | |||
541 | new_timer->it_process = process; | 540 | new_timer->it_process = process; |
542 | list_add(&new_timer->list, ¤t->signal->posix_timers); | 541 | list_add(&new_timer->list, ¤t->signal->posix_timers); |
543 | spin_unlock_irq(¤t->sighand->siglock); | 542 | spin_unlock_irq(¤t->sighand->siglock); |
543 | |||
544 | return 0; | ||
544 | /* | 545 | /* |
545 | * In the case of the timer belonging to another task, after | 546 | * In the case of the timer belonging to another task, after |
546 | * the task is unlocked, the timer is owned by the other task | 547 | * the task is unlocked, the timer is owned by the other task |
@@ -548,9 +549,7 @@ sys_timer_create(const clockid_t which_clock, | |||
548 | * new_timer after the unlock call. | 549 | * new_timer after the unlock call. |
549 | */ | 550 | */ |
550 | out: | 551 | out: |
551 | if (error) | 552 | release_posix_timer(new_timer, it_id_set); |
552 | release_posix_timer(new_timer, it_id_set); | ||
553 | |||
554 | return error; | 553 | return error; |
555 | } | 554 | } |
556 | 555 | ||