Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52AE646D0A0 for ; Wed, 9 Sep 2026 09:38:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788946700; cv=none; b=TUbkaEVHUE2///yq6G2+63HQudK6J2oQEtpQ9O0B1zynHq7kLbphJlZqPTcAgaWPz2ShyDWLAN7gE2Ba6uRvVuCj5Ik9Btq4kMoaP+2HlN/77qbogRD+euVduCafKc1Ro6mHkd03BC3E/gt0dYI5hv5P8m9gv5EgGE/tiU0saC8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788946700; c=relaxed/simple; bh=D0Fldd+O6dvBM2yRsP27sS3VFiYS2cbzueQ/cs8nPDI=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=OMzT+gjVSxD+NjE1OOMiGxyUQwOYGV/u8Qjbc+na+X3qkbiXMctCJxg6bYEKMg6rMmnv2h0GM6hmAfcb1dGK8HxqOH/XowWeBgPcMuzEm7ol9ebTxt6B5joj/JgWsbv6ygEecqEQa6WKzf9JoMczUcR38bz2a9l4Iczry4M1RsE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jr5mufhp; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="jr5mufhp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F6A51F00A3A; Wed, 9 Sep 2026 09:38:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788946695; bh=ktDjZGM9YHchlwH0/HPuGMxYm2unRRDgPqHIckvYc6o=; h=Subject:To:Cc:From:Date; b=jr5mufhp753GZtqvTKSWXoA663kZki38JdtoonETkjG4lXtKvYg47g/UdZ4/1S8EQ y+TRk5hzZ3oReAxgB5tIZ860tvqmWmh8BidfcMkQxglJ+CyyV31K0MaGLm+mFfnF6Z Stg9YynnOXG+pWaCAEO7EeDuUooCybsT63Rqbzp0= Subject: FAILED: patch "[PATCH] rtc: rzn1: Handle unset alarm weekday in rzn1_rtc_read_alarm" failed to apply to 6.6-stable tree To: prabhakar.mahadev-lad.rj@bp.renesas.com,alexandre.belloni@bootlin.com,wsa+renesas@sang-engineering.com Cc: From: Date: Wed, 09 Sep 2026 11:38:00 +0200 Message-ID: <2026090900-ended-professor-5de8@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 457b5dbce31209e65e1184716ed3af59cb1c0372 # git commit -s git send-email --to '' --in-reply-to '2026090900-ended-professor-5de8@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 457b5dbce31209e65e1184716ed3af59cb1c0372 Mon Sep 17 00:00:00 2001 From: Lad Prabhakar Date: Fri, 21 Aug 2026 22:10:19 +0100 Subject: [PATCH] rtc: rzn1: Handle unset alarm weekday in rzn1_rtc_read_alarm RZN1_RTC_ALW is a weekday bitmask where bit N represents weekday N. When no alarm has been configured, the register has its power-on-reset value of zero. rzn1_rtc_read_alarm() uses fls() to convert the weekday bitmask into a weekday number. When RZN1_RTC_ALW is zero, fls(0) returns zero and fls(wday) - 1 evaluates to -1. This invalid weekday is then used to calculate the alarm date and can either leave tm_wday set to -1 or produce a fabricated alarm date. Treat a zero RZN1_RTC_ALW value as an unset alarm weekday and return without calculating the alarm date. Move reading RZN1_RTC_CTL1 before this check so that alrm->enabled is updated for both configured and unconfigured alarms. Fixes: b5ad1bf00d2c4 ("rtc: rzn1: Add alarm support") Cc: stable@vger.kernel.org Signed-off-by: Lad Prabhakar Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Link: https://patch.msgid.link/20260821211032.13554-5-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Alexandre Belloni diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c index 56284a4320ae..d4cba0d415b6 100644 --- a/drivers/rtc/rtc-rzn1.c +++ b/drivers/rtc/rtc-rzn1.c @@ -235,13 +235,24 @@ static int rzn1_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) if (ret) return ret; + ctl1 = readl(rtc->base + RZN1_RTC_CTL1); + alrm->enabled = !!(ctl1 & (RZN1_RTC_CTL1_ALME | RZN1_RTC_CTL1_1SE)); + min = readl(rtc->base + RZN1_RTC_ALM); hour = readl(rtc->base + RZN1_RTC_ALH); - wday = readl(rtc->base + RZN1_RTC_ALW); tm->tm_sec = 0; tm->tm_min = bcd2bin(min); tm->tm_hour = bcd2bin(hour); + + /* + * If wday is zero, no bit is set in RZN1_RTC_ALW. This is the + * register's power-on reset value. + */ + wday = readl(rtc->base + RZN1_RTC_ALW); + if (!wday) + return 0; + delta_days = ((fls(wday) - 1) - tm->tm_wday + 7) % 7; tm->tm_wday = fls(wday) - 1; @@ -250,9 +261,6 @@ static int rzn1_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) rtc_time64_to_tm(alarm, tm); } - ctl1 = readl(rtc->base + RZN1_RTC_CTL1); - alrm->enabled = !!(ctl1 & (RZN1_RTC_CTL1_ALME | RZN1_RTC_CTL1_1SE)); - return 0; }