On Wed, Aug 19, 2026 at 11:39:14AM +0100, Prabhakar wrote: > From: Lad Prabhakar > > 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: stable@vger.kernel.org > Signed-off-by: Lad Prabhakar Suggested-by: Wolfram Sang Reviewed-by: Wolfram Sang