Re: [PATCH v4 06/15] rtc: rzn1: Fix alarm range check truncation on 32-bit systems

"Lad, Prabhakar" <[email protected]>
Newsgroups dev.linux.lists.sashiko-reviews,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-rtc
Message-ID <CA+V-a8vuA5EnPP8iCsCi2e3HY-qO6iNs=1bP-NnfQMDrrQK0vQ@mail.gmail.com>
Hi Wolfram,

On Wed, Aug 19, 2026 at 2:05 PM Wolfram Sang
<[email protected]> wrote:
>
>
> > [Severity: High]
> > This is a pre-existing issue, but can this sequence of register writes
> > trigger a spurious interrupt?
>
> I think this is true.
>
Agreed, I will add a patch to disable the interrupts before
programming the ALx registers.

diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index 44e8db466cb7..09631a3a5134 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -280,6 +280,11 @@ static int rzn1_rtc_set_alarm(struct device *dev,
struct rtc_wkalrm *alrm)
        if (alarm > farest)
                return -ERANGE;

+       /* Disable alarm interrupts before reprogramming the alarm. */
+       ret = rzn1_rtc_alarm_irq_enable(dev, 0);
+       if (ret)
+               return ret;
+
        writel(bin2bcd(tm->tm_min), rtc->base + RZN1_RTC_ALM);
        writel(bin2bcd(tm->tm_hour), rtc->base + RZN1_RTC_ALH);
        writel(BIT(tm->tm_wday), rtc->base + RZN1_RTC_ALW);

Cheers,
Prabhakar
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.