Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/rtc/interface.c: return -EBUSY, not -EACCES when device is busy

If rtc->irq_task is non-NULL and task is NULL, they always
rtc_irq_set_freq(), whenever err is set to -EBUSY it will then immediately
be set to -EACCES, misleading the caller as to the underlying problem.

Signed-off-by: Chris Brand <chris.brand@broadcom.com>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Chris Brand and committed by
Linus Torvalds
0734e27f 5ee67484

+4 -4
+4 -4
drivers/rtc/interface.c
··· 698 698 spin_lock_irqsave(&rtc->irq_task_lock, flags); 699 699 if (rtc->irq_task != NULL && task == NULL) 700 700 err = -EBUSY; 701 - if (rtc->irq_task != task) 701 + else if (rtc->irq_task != task) 702 702 err = -EACCES; 703 - if (!err) { 703 + else { 704 704 if (rtc_update_hrtimer(rtc, enabled) < 0) { 705 705 spin_unlock_irqrestore(&rtc->irq_task_lock, flags); 706 706 cpu_relax(); ··· 734 734 spin_lock_irqsave(&rtc->irq_task_lock, flags); 735 735 if (rtc->irq_task != NULL && task == NULL) 736 736 err = -EBUSY; 737 - if (rtc->irq_task != task) 737 + else if (rtc->irq_task != task) 738 738 err = -EACCES; 739 - if (!err) { 739 + else { 740 740 rtc->irq_freq = freq; 741 741 if (rtc->pie_enabled && rtc_update_hrtimer(rtc, 1) < 0) { 742 742 spin_unlock_irqrestore(&rtc->irq_task_lock, flags);