]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rtc: interface: Alarm race handling should not discard preceding error
authorAnthony Pighin (Nokia) <anthony.pighin@nokia.com>
Tue, 25 Nov 2025 17:35:19 +0000 (17:35 +0000)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 20 Feb 2026 21:49:17 +0000 (22:49 +0100)
commit81be22cd4ace020045cc6d31255c6f7c071eb7c0
tree1d08f8a43b094c5ede7d2faa6d27cd53eb740126
parent8eeb611b3d16241559bbf81ae5d938368c87818c
rtc: interface: Alarm race handling should not discard preceding error

Commit 795cda8338ea ("rtc: interface: Fix long-standing race when setting
alarm") should not discard any errors from the preceding validations.

Prior to that commit, if the alarm feature was disabled, or the
set_alarm failed, a meaningful error code would be returned to the
caller for further action.

After, more often than not, the __rtc_read_time will cause a success
return code instead, misleading the caller.

An example of this is when timer_enqueue is called for a rtc-abx080x
device. Since that driver does not clear the alarm feature bit, but
instead relies on the set_alarm operation to return invalid, the discard
of the return code causes very different behaviour; i.e.
    hwclock: select() to /dev/rtc0 to wait for clock tick timed out

Fixes: 795cda8338ea ("rtc: interface: Fix long-standing race when setting alarm")
Signed-off-by: Anthony Pighin (Nokia) <anthony.pighin@nokia.com>
Reviewed-by: Esben Haabendal <esben@geanix.com>
Tested-by: Nick Bowler <nbowler@draconx.ca>
Link: https://patch.msgid.link/BN0PR08MB6951415A751F236375A2945683D1A@BN0PR08MB6951.namprd08.prod.outlook.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/interface.c