Skip to content

Commit 1311a8f

Browse files
superm1alexandrebelloni
authored andcommitted
rtc: Adjust failure return code for cmos_set_alarm()
When mc146818_avoid_UIP() fails to return a valid value, this is because UIP didn't clear in the timeout period. Adjust the return code in this case to -ETIMEDOUT. Tested-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Reviewed-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Acked-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Cc: <stable@vger.kernel.org> Fixes: cdedc45 ("rtc: cmos: avoid UIP when reading alarm time") Fixes: cd17420 ("rtc: cmos: avoid UIP when writing alarm time") Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20231128053653.101798-3-mario.limonciello@amd.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent af83863 commit 1311a8f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/rtc/rtc-cmos.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ static int cmos_read_alarm(struct device *dev, struct rtc_wkalrm *t)
292292

293293
/* This not only a rtc_op, but also called directly */
294294
if (!is_valid_irq(cmos->irq))
295-
return -EIO;
295+
return -ETIMEDOUT;
296296

297297
/* Basic alarms only support hour, minute, and seconds fields.
298298
* Some also support day and month, for alarms up to a year in
@@ -557,7 +557,7 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t)
557557
* Use mc146818_avoid_UIP() to avoid this.
558558
*/
559559
if (!mc146818_avoid_UIP(cmos_set_alarm_callback, &p))
560-
return -EIO;
560+
return -ETIMEDOUT;
561561

562562
cmos->alarm_expires = rtc_tm_to_time64(&t->time);
563563

0 commit comments

Comments
 (0)