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 25E3F46F49B; Tue, 21 Jul 2026 17:33:05 +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=1784655186; cv=none; b=u54r0S9F8G+o19P5y3pNBsRBSDHAC5dzuqgJNZ2qBi0AJBHQ0R0+ysPLRN4h+T6KWze8ZIbLVxPCGwmSjRshg/JDSHFd8AJmxBikQhr9jcFEUx3QKyLqoJsBWKdhb4U/pqHu/URjhO8/nhwQq1HFOo3FXOZgrLj/q+dSuLc521Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784655186; c=relaxed/simple; bh=1ddx1bucY41S7eFom1Qse7jgjsQekz0tNOTu2bEGiGU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TrDqWw2E10qGPuaD7NA5GLEGeKXaKl2aZh2kP7Kx8cwUU2CP5jr6OvewMZkw0dYEpjHRGga3+iRB0Hl9weSdBSGfP9CGuTNZSd/peDgxTYq9TWm7NhI71qqv59oFIASzyE5bnm6dnMN2eoq6+hX9Hf45nP2Ny4HEbKgQkDBHe7c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RB7bJLcP; 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="RB7bJLcP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C0531F000E9; Tue, 21 Jul 2026 17:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784655185; bh=b/fEt/nNFfaw+eZ6g4Vu+1fPXKhlx4iYtDpfbEV83vE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RB7bJLcPgCHPyQ3S7GKFeuoUwwmVXOHVBzqs05PwOsmjDEXBoHvBODcTNjFucRVaE Oww93+Uh9wS074KtsOfTSAYtn8JBWPHqcSnPmv+Jp943SH2Vip2APjim+6HcZFV+Nv mBk87n1DvCBCvtqla0mMZXDd1nRT6vqAZM3Cjf/o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lad Prabhakar , Claudiu Beznea , Alexandre Belloni Subject: [PATCH 7.1 1944/2077] rtc: renesas-rtca3: Fix PIE clear polling condition in alarm setup error path Date: Tue, 21 Jul 2026 17:26:57 +0200 Message-ID: <20260721152638.560942057@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152552.646164743@linuxfoundation.org> References: <20260721152552.646164743@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lad Prabhakar commit 7e342d87aa8e6b831cf6d21ca41b1f7e032d0fcf upstream. In rtca3_set_alarm(), the setup_failed path attempts to disable the Periodic Interrupt Enable (PIE) bit and wait until it is cleared. However, the polling condition passed to readb_poll_timeout_atomic() uses an incorrect expression: !(tmp & ~RTCA3_RCR1_PIE) As ~RTCA3_RCR1_PIE evaluates to a mask of all bits except PIE, the condition effectively waits for all non-PIE bits to become zero, which is unrelated to the intended operation and is unlikely to ever be true. This causes the poll to time out unnecessarily. Fix the condition to check for the PIE bit itself being cleared: !(tmp & RTCA3_RCR1_PIE) This correctly waits until PIE is deasserted after being cleared. Fixes: d4488377609e3 ("rtc: renesas-rtca3: Add driver for RTCA-3 available on Renesas RZ/G3S SoC") Cc: stable@vger.kernel.org Signed-off-by: Lad Prabhakar Reviewed-by: Claudiu Beznea Tested-by: Claudiu Beznea # on RZ/G3S Link: https://patch.msgid.link/20260602192559.1791344-2-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Alexandre Belloni Signed-off-by: Greg Kroah-Hartman --- drivers/rtc/rtc-renesas-rtca3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/rtc/rtc-renesas-rtca3.c +++ b/drivers/rtc/rtc-renesas-rtca3.c @@ -455,7 +455,7 @@ setup_failed: * specified timeout for setup. */ writeb(rcr1 & ~RTCA3_RCR1_PIE, priv->base + RTCA3_RCR1); - readb_poll_timeout_atomic(priv->base + RTCA3_RCR1, tmp, !(tmp & ~RTCA3_RCR1_PIE), + readb_poll_timeout_atomic(priv->base + RTCA3_RCR1, tmp, !(tmp & RTCA3_RCR1_PIE), 10, RTCA3_DEFAULT_TIMEOUT_US); atomic_set(&priv->alrm_sstep, RTCA3_ALRM_SSTEP_DONE); }