Skip to contentSkip to conversation

rtc: stop warning for invalid alarms when the alarm is disabled

PATCH New [email protected] 1 participant 1 message Aug 27, 2023 Real time clock (RTC)

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 rtc: stop warning for invalid alarms when the alarm is disabled

From: Alexandre Belloni <[email protected]>

When the alarm is not enabled, it may never have been set and so we can't expect it to be valid. This will prevent the apparition of boot messages like this one:

rtc rtc0: invalid alarm value: 2023-7-8 45:85:85

---
 drivers/rtc/interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/interface.c +1 -1
index 499d89150afc..1b63111cdda2 100644
@@ -376,7 +376,7 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
 	err = rtc_valid_tm(&alarm->time);
 
 done:
-	if (err)
+	if (err && alarm->enabled)
 		dev_warn(&rtc->dev, "invalid alarm value: %ptR\n",
 			 &alarm->time);
 
Signature · 1 line
2.41.0