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:
parent
f0b3e4e850
commit
4eac3db1b9
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue