]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers/rtc/interface.c: return -EBUSY, not -EACCES when device is busy
authorChris Brand <chris.brand@broadcom.com>
Wed, 19 Jun 2013 00:08:09 +0000 (10:08 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Jun 2013 07:27:34 +0000 (17:27 +1000)
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>
drivers/rtc/interface.c

index 14c1efdd07575200521f70a3f938ea140380017c..72c5cdbe0791afd2fed9a4779e5769c82c6b6ba3 100644 (file)
@@ -698,9 +698,9 @@ retry:
        spin_lock_irqsave(&rtc->irq_task_lock, flags);
        if (rtc->irq_task != NULL && task == NULL)
                err = -EBUSY;
-       if (rtc->irq_task != task)
+       else if (rtc->irq_task != task)
                err = -EACCES;
-       if (!err) {
+       else {
                if (rtc_update_hrtimer(rtc, enabled) < 0) {
                        spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
                        cpu_relax();
@@ -734,9 +734,9 @@ retry:
        spin_lock_irqsave(&rtc->irq_task_lock, flags);
        if (rtc->irq_task != NULL && task == NULL)
                err = -EBUSY;
-       if (rtc->irq_task != task)
+       else if (rtc->irq_task != task)
                err = -EACCES;
-       if (!err) {
+       else {
                rtc->irq_freq = freq;
                if (rtc->pie_enabled && rtc_update_hrtimer(rtc, 1) < 0) {
                        spin_unlock_irqrestore(&rtc->irq_task_lock, flags);