drivers: rtc: rtc_mc146818: Patch incorrect field comparisons

Minutes and hour values are incorrectly compared with MAX_SEC.

Compare minutes and hour to MAX_MIN and MAX_HOUR respectively.

Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
This commit is contained in:
Daniel Kampert 2024-05-27 13:39:49 +02:00 committed by Carles Cufí
parent 87dbd81168
commit 246e614ac3

View File

@ -377,13 +377,13 @@ static int rtc_mc146818_alarm_get_time(const struct device *dev, uint16_t id, ui
}
value = rtc_read(RTC_ALARM_MIN);
if (value <= MAX_SEC) {
if (value <= MAX_MIN) {
timeptr->tm_min = value;
(*mask) |= RTC_ALARM_TIME_MASK_MINUTE;
}
value = rtc_read(RTC_ALARM_HOUR);
if (value <= MAX_SEC) {
if (value <= MAX_HOUR) {
timeptr->tm_hour = value;
(*mask) |= RTC_ALARM_TIME_MASK_HOUR;
}