Re: [PATCH v5 03/17] rtc: rzn1: Fix weekday underflow when alarm crosses month boundary
| Newsgroups | org.kernel.vger.linux-rtc,org.kernel.vger.linux-devicetree |
|---|---|
| Message-ID | <[email protected]> |
> From: Lad Prabhakar <[email protected]> > > rzn1_rtc_set_alarm() calculates the alarm weekday from the difference > between the alarm day and the current day of the month. When the alarm > crosses a month boundary, this difference can become negative. Since > days_ahead is unsigned, it underflows and results in an incorrect > weekday being programmed into RZN1_RTC_ALW. > > The RTC core already provides a fully populated struct rtc_time for > the alarm, including the correct tm_wday. Use tm->tm_wday directly > instead of recalculating the weekday from the day-of-month. > > This avoids the underflow and ensures alarms scheduled across a month > boundary use the correct weekday. > > Fixes: b5ad1bf00d2c4 ("rtc: rzn1: Add alarm support") > Cc: [email protected] > Signed-off-by: Lad Prabhakar <[email protected]> Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3