drivers: rtc: stm32: check if tm_wday is set

tm/rtc_time structure allow for tm_wday to be set to -1 if unknown but RTC
is expecting it

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
This commit is contained in:
Johan Lafon 2023-09-11 12:18:57 +02:00 committed by Fabio Baltieri
commit 4eac3db1b9

View file

@ -138,6 +138,11 @@ static int rtc_stm32_set_time(const struct device *dev, const struct rtc_time *t
return -EINVAL;
}
if (timeptr->tm_wday == -1) {
/* day of the week is expected */
return -EINVAL;
}
LOG_INF("Setting clock");
LL_RTC_DisableWriteProtection(RTC);