OSDN Git Service

rtc: ensure rtc_set_alarm fails when alarms are not supported
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 5 Jun 2018 21:09:14 +0000 (23:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Aug 2018 14:24:30 +0000 (16:24 +0200)
commitaf1ecd4b5f740c30f7ed72bb8af0d7f74cc1b88d
tree9970e516b01f1affa5193dd44f8cbced21e71067
parent3231613224c076ed1f0984e382cbd2df0d64c260
rtc: ensure rtc_set_alarm fails when alarms are not supported

[ Upstream commit abfdff44bc38e9e2ef7929f633fb8462632299d4 ]

When using RTC_ALM_SET or RTC_WKALM_SET with rtc_wkalrm.enabled not set,
rtc_timer_enqueue() is not called and rtc_set_alarm() may succeed but the
subsequent RTC_AIE_ON ioctl will fail. RTC_ALM_READ would also fail in that
case.

Ensure rtc_set_alarm() fails when alarms are not supported to avoid letting
programs think the alarms are working for a particular RTC when they are
not.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/rtc/interface.c