Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jiawen Liu <liu1298662399@gmail.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
	Peter Griffin <peter.griffin@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org
Subject: [PATCH] serial: samsung: Handle clock enable errors in noirq resume
Date: Sun, 29 Nov 2026 19:25:33 +0000	[thread overview]
Message-ID: <179598034086.2.8243056622030752053.pattern-ext-118.18@gmail.com> (raw)

On Exynos5433 TM2 and TM2e, the audio UART gets its controller clock
from the audio CMU. If the CMU is runtime-suspended and runtime PM is
still disabled during noirq resume, preparing the clock can fail with
-EACCES. The S3C6400 resume callback ignores the error, attempts to
write the interrupt mask without acquiring the controller clock, and
releases an unacquired clock reference. The clock framework warns
when the enable or prepare count is zero.

Return the clock error before writing the interrupt mask. If enabling
a present baud clock fails, release the controller clock before
returning the error. The PM core reports the error and continues
system resume.

The drafting input was the source
review of the noirq clock failure. Verification included source
inspection of the clock paths, an ARM64 Exynos driver object build
with CONFIG_PM_SLEEP=y, checkpatch, and git diff --check. No runtime
or hardware reproduction was performed.

Fixes: a8a1781b8726 ("serial: samsung: enable clock before accessing interrupt mask resister")
Signed-off-by: Jiawen Liu <liu1298662399@gmail.com>
---
 drivers/tty/serial/samsung_tty.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index 7ce8f2f993e21..72018a1fbd87e 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -2103,14 +2103,24 @@ static int s3c24xx_serial_resume_noirq(struct device *dev)
 		switch (ourport->info->type) {
 		case TYPE_S3C6400: {
 			u32 uintm = 0xf;
+			int ret;
 
 			if (ourport->tx_enabled)
 				uintm &= ~S3C64XX_UINTM_TXD_MSK;
 			if (ourport->rx_enabled)
 				uintm &= ~S3C64XX_UINTM_RXD_MSK;
-			clk_prepare_enable(ourport->clk);
-			if (!IS_ERR(ourport->baudclk))
-				clk_prepare_enable(ourport->baudclk);
+
+			ret = clk_prepare_enable(ourport->clk);
+			if (ret)
+				return ret;
+			if (!IS_ERR(ourport->baudclk)) {
+				ret = clk_prepare_enable(ourport->baudclk);
+				if (ret) {
+					clk_disable_unprepare(ourport->clk);
+					return ret;
+				}
+			}
+
 			wr_regl(port, S3C64XX_UINTM, uintm);
 			if (!IS_ERR(ourport->baudclk))
 				clk_disable_unprepare(ourport->baudclk);
-- 
2.34.1


                 reply	other threads:[~2026-11-29 19:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179598034086.2.8243056622030752053.pattern-ext-118.18@gmail.com \
    --to=liu1298662399@gmail.com \
    --cc=alim.akhtar@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=peter.griffin@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox