aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHyogi Gim <hyogi.gim@lge.com>2015-05-14 01:01:59 +0000
committerJohannes Weiner <hannes@cmpxchg.org>2015-05-14 01:01:59 +0000
commit381d486dc40979490409e2d91cf87ef5eb5546ec (patch)
tree40e93e38f9a0d3a20fff65ceb0e18cc66e77c203
parentb2183a19e936e307c8e35bb763334f818b1c07fe (diff)
downloadmm-next-381d486dc40979490409e2d91cf87ef5eb5546ec.tar.gz
drivers/rtc/interface.c: check the error after __rtc_read_time()
Add the verification code for returned __rtc_read_time() error in rtc_update_irq_enable() and rtc_timer_do_work(). Signed-off-by: Hyogi Gim <hyogi.gim@lge.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--drivers/rtc/interface.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 166fc60d8b551f..96268fc113373e 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -494,7 +494,10 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
struct rtc_time tm;
ktime_t now, onesec;
- __rtc_read_time(rtc, &tm);
+ err = __rtc_read_time(rtc, &tm);
+ if (err < 0)
+ goto out;
+
onesec = ktime_set(1, 0);
now = rtc_tm_to_ktime(tm);
rtc->uie_rtctimer.node.expires = ktime_add(now, onesec);
@@ -872,13 +875,17 @@ void rtc_timer_do_work(struct work_struct *work)
struct timerqueue_node *next;
ktime_t now;
struct rtc_time tm;
+ int err = 0;
struct rtc_device *rtc =
container_of(work, struct rtc_device, irqwork);
mutex_lock(&rtc->ops_lock);
again:
- __rtc_read_time(rtc, &tm);
+ err = __rtc_read_time(rtc, &tm);
+ if (err < 0)
+ goto out;
+
now = rtc_tm_to_ktime(tm);
while ((next = timerqueue_getnext(&rtc->timerqueue))) {
if (next->expires.tv64 > now.tv64)
@@ -903,7 +910,6 @@ again:
/* Set next alarm */
if (next) {
struct rtc_wkalrm alarm;
- int err;
int retry = 3;
alarm.time = rtc_ktime_to_tm(next->expires);
@@ -925,6 +931,7 @@ reprogram:
} else
rtc_alarm_disable(rtc);
+out:
pm_relax(rtc->dev.parent);
mutex_unlock(&rtc->ops_lock);
}