Hi,

Am 2022-04-25 14:55, schrieb Oliver Graute:
I stumbled across the following possible off-by-one error in counting the
month in RTC driver rv8803.
..

(drivers/rtc/rv8803.c)
rv8803_rtc_set()
...
buf[RTC_MON_REG_ADDR] = bin2bcd(tm->tm_mon)
...

rv8803_rtc_get()
...
tm->tm_mon  = bcd2bin(buf[RTC_MON_REG_ADDR] & 0x1F);
...

I assume that the error is here and increase and decrease by one is also
required here like in the Linux driver code for RTC 8803.

Indeed. tm_mon has a range from 0 .. 11, but the RTC expects 1..12.
Nice catch.

Can someone verify and comment on this. Then I would prepare a patch
later on.

Yes please.

-michael

Reply via email to