[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20141217135150.b02a4581cebd819f0f8f078a@linux-foundation.org>
Date: Wed, 17 Dec 2014 13:51:50 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Hyogi Gim <hyogi.gim@....com>
Cc: a.zummo@...ertech.it, rtc-linux@...glegroups.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers/rtc/interface.c: check the error after
__rtc_read_time()
On Wed, 17 Dec 2014 12:15:24 +0900 Hyogi Gim <hyogi.gim@....com> wrote:
> Add the verification code for returned __rtc_read_time() error in
> rtc_update_irq_enable() and rtc_timer_do_work().
>
> ...
L
> --- a/drivers/rtc/interface.c
> +++ b/drivers/rtc/interface.c
> @@ -489,7 +489,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);
I'm not sure about this part. If __rtc_read_time() returns -EINVAL
(due to !rtc->ops->read_time) then rtc_update_irq_enable() will go and
call rtc_dev_update_irq_enable_emul(), inappropriately.
On the other hand, if __rtc_read_time() returns -EINVAL because that's
what rtc->ops->read_time() returned then perhaps
rtc_update_irq_enable() *should* call rtc_dev_update_irq_enable_emul().
Messy.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists