From: tip-bot for John Stultz <john.stultz@linaro.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, john.stultz@linaro.org,
hpa@zytor.com, mingo@redhat.com, tglx@linutronix.de
Subject: [tip:timers/urgent] RTC: Properly handle rtc_read_alarm error propagation and fix bug
Date: Fri, 21 Jan 2011 16:41:04 GMT [thread overview]
Message-ID: <tip-d5553a556165535337ece8592f066407c62eec2e@git.kernel.org> (raw)
In-Reply-To: <1295565973-14358-2-git-send-email-john.stultz@linaro.org>
Commit-ID: d5553a556165535337ece8592f066407c62eec2e
Gitweb: http://git.kernel.org/tip/d5553a556165535337ece8592f066407c62eec2e
Author: John Stultz <john.stultz@linaro.org>
AuthorDate: Thu, 20 Jan 2011 15:26:13 -0800
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 21 Jan 2011 17:38:19 +0100
RTC: Properly handle rtc_read_alarm error propagation and fix bug
In reviewing cases where the virtualized interfaces didn't propagate
errors properly, I noticed rtc_read_alarm needed fixing. In doing
so I noticed my RTC rework dropped a memset and that the behavior
of rtc_read_alarm shouldn't be conditionalized on the alarm.enabled
flag (as the alarm may be set, but the irqs may be disabled). So
those were corrected as well.
CC: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
LKML-Reference: <1295565973-14358-2-git-send-email-john.stultz@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/rtc/interface.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index f1ba2c6..925006d 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -123,12 +123,18 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
err = mutex_lock_interruptible(&rtc->ops_lock);
if (err)
return err;
- alarm->enabled = rtc->aie_timer.enabled;
- if (alarm->enabled)
+ if (rtc->ops == NULL)
+ err = -ENODEV;
+ else if (!rtc->ops->read_alarm)
+ err = -EINVAL;
+ else {
+ memset(alarm, 0, sizeof(struct rtc_wkalrm));
+ alarm->enabled = rtc->aie_timer.enabled;
alarm->time = rtc_ktime_to_tm(rtc->aie_timer.node.expires);
+ }
mutex_unlock(&rtc->ops_lock);
- return 0;
+ return err;
}
EXPORT_SYMBOL_GPL(rtc_read_alarm);
next prev parent reply other threads:[~2011-01-21 16:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-20 23:26 [PATCH 1/2] RTC: Propagate error handling via rtc_timer_enqueue properly John Stultz
2011-01-20 23:26 ` [PATCH 2/2] RTC: Properly handle rtc_read_alarm error propagation and fix bug John Stultz
2011-01-21 16:41 ` tip-bot for John Stultz [this message]
2011-01-21 16:40 ` [tip:timers/urgent] RTC: Propagate error handling via rtc_timer_enqueue properly tip-bot for John Stultz
2011-02-14 10:33 ` [PATCH] rtc: release mutex in error path of rtc_alarm_irq_enable Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-d5553a556165535337ece8592f066407c62eec2e@git.kernel.org \
--to=john.stultz@linaro.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome