RTC: Release mutex in error path of rtc_alarm_irq_enable
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 14 Feb 2011 10:33:17 +0000 (11:33 +0100)
committerJohn Stultz <john.stultz@linaro.org>
Thu, 17 Feb 2011 22:59:22 +0000 (14:59 -0800)
On hardware that doesn't support alarm interrupts, rtc_alarm_irq_enable
could return without releasing the ops_lock mutex.

This was introduced in
aa0be0f (RTC: Propagate error handling via rtc_timer_enqueue properly)

This patch corrects the issue by only returning once the mutex is
released.

[john.stultz: Reworded the commit log]

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
drivers/rtc/interface.c

index a0c01967244d381e1aecf3665a885be191efbb24..413ae05379156751df8773ad70821c6af2254cfe 100644 (file)
@@ -209,9 +209,8 @@ int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled)
        }
 
        if (err)
-               return err;
-
-       if (!rtc->ops)
+               /* nothing */;
+       else if (!rtc->ops)
                err = -ENODEV;
        else if (!rtc->ops->alarm_irq_enable)
                err = -EINVAL;