From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795980963; b=YIo451ZwANcFCJSOVcEGlscMffidVmsJaDl+LooKphyyNU5qzxdJ/llnIY7ZILP7d4v2 +wsU5w9CwERbJL3fGiAcnA3Ld0qxwyuDnqmDdfMavvwoRkQAwKviVGRqi68oCmJpVwI8D XH/tCiXROsSn/pWGGam8Fynh4VN73HofHoC/lWkkgHINU9y97rf+D5xMp9R/uhfKqBiQn ArrQCVZxa/T2TLij3Y9ZwT8/IiUcw5UF1o9sBo5Yb+ChuoPcAH3XyGFz90yftudcLmion F1Wm3N0OuwsKZDKeLV1Jgh0s5/xK2H3HyLVblo+t7oQK2oaXBZRsPHV3yq+fn31QHeQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795980963; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=iMUJkIeYsb5uVFhMOlniNZVnDNNEOlS7KBkdDwwxPQU=; b=L15aySwUaFVokxRnAjD4X6YgTaej9dnLHpo1YzoD+94QhBarEAFsiZyNd7ALQiwYHjmT YH0ZvAChA5Uaf5g25ybQm4cHMdDifAzn/2+dRC/u/pjBSTqCKMVAIeuevH/yXJfCn6GXe elqbVectP/29MXyFu6V8XVdjybpCLotdYU2NZ4GF59kE8Nf+vqeZDh0fsn0x1lc6gX+cO udwF35VbLg4sJ8ihIeDwTh65ke9dgiezBy/aPrZzALj/FagOzMyRAQeYTBc4bN3rI0jvU SKZKMCdwT20jh+7Ov0Qt4osmVOnSoSD+YU10sd+/TtUrRvhFOgj0yCbNeqxp6iOqoXQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=MttnD0Lk; arc=none smtp.remote-ip=209.85.167.47 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7848F606A325 for ; Sun, 29 Nov 2026 19:36:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7848F606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=MttnD0Lk Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5c148d4dbfbso8011786e87.3 for ; Sun, 29 Nov 2026 11:36:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795980962; x=1796585762; darn=vger.kernel.org; h=mime-version:content-transfer-encoding:content-type:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=iMUJkIeYsb5uVFhMOlniNZVnDNNEOlS7KBkdDwwxPQU=; b=MttnD0LkiCwQf2YZMxO6nMqUaMKHEMCicWHM/hbnobvXlryHGy+Qo7OujIM2VtfQcH GatKOLIWFS/iOwNvrFXK4WkoR3cyvZvs7Rwf2vZwTiSLVNgOY/X2XZU9ZK8tEtjX158/ ysGt0nS5fJ2vqRc0vmCmwiBF1F35f2mtSfB4JZ3uZrroysDNHpOZnmoFPwadnf4VX2j6 PUjBnvKGbqmxAWuZkv0IKWBxidCqOTiBM2hXUou7Jo8MjBNDDnDdq4l2IdADOpw1FCBt DYWDkyky0xmMuKj9zcosHeKO/+vVr3QQHjZ1DB0LGQAKxB14n95jkXzezPF7bPZXl7fe wSfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795980962; x=1796585762; h=mime-version:content-transfer-encoding:content-type:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=iMUJkIeYsb5uVFhMOlniNZVnDNNEOlS7KBkdDwwxPQU=; b=PkoRuZC25nAbsT3KEqgcEMA8VyhwopAQlgAzBKOCb/PpsG+C3quOVVQ+n50CeI4QPT ha5YBYtjOSPII3SRnu6uUW05Qhy/xAeMN4V5yy2rdeONTQu6zWnoKk2KjO6r6LSeD4bm XXkho6JyNEKqGswPAX5NGomowSiu9dxRb9a6Z+2W7sn3IlvpXfmivEfiAtnGGRX5Q/Aa EVHYuvoQlq28RBr3taDkqpt1IFsbsj+8sNHFEJZe8PYwu7twxlcLPVbjhopUx6mIZWNk KgrfIlQ5ie+m61DEm1tKpfE8i/GbbSKT0YYZO5MLYD3p8NGCzP+pgReWrOnZT5RFtmN/ CN8Q== X-Forwarded-Encrypted: i=1; AL+hErHa+wTPEzLQrw5rm95nnXEtOGe4xBHbilYX1tB+iZdW7HsSJvarYvcTHiEtkincsw7Pc1LG1wTdvkcv8hs=@vger.kernel.org X-Gm-Message-State: APuU4Z9vF9fnmGENGq7QkfeWFJAjLXuz1+UXleWivLjUzsMEsGct471E QKd1QRSQ7RDSoL92/nmzFiyMSrzfyIk4dVCa+MmJeHPMhFbu3dmzIyZz X-Gm-Gg: AZFdTZfzRw+jPA9FJqQI+pwxEgDh+zhSu/+Jkgoa7lsTxbjh65pCUk1s58MMwf8xwO/ +Md3Zpiztytsqie0dWLN3+JLh9hishGQ1y1LX0geQHoouxLAx7BinwCGzfZ/hurL1kOoQzQ/qsa xrpoEWvhTRm9O2UFk/LE09yLB3OtVwv2NnQBAQRnl9hFrOJlA4itJeJQb59Azy99ytwA2fOJ29s Ire5lWk+kCe17PaMxHKN4yMQJpnZ5sHneCT7XqgA+7QJw2A6hZCDcQZOyKmv6MX+cuWS77p7KT0 CZsmcuuwJN4PFmoJK3NC81FGjRzafoOLQOZ+dM98Glyt/CIwH8h8nOOv5DPSyoBLvdJTrGHOipX yC+JBZ5xPKsXWKX0VIUk71oMbWJIQP2nr1bSevJKrE3JR35V9hCcRZJRbiw13Gk7Qn2HoG5LNKn eWGFK+Me7+i8pDtK7g+QYlU6IxG7SxM4/VWZ+g8ax1dRS/WlXlTRsRvoWdJxozwD04tNNbNkGp0 axJolCj/lLEwMAAdIsWC6b31+mtHB6S5BXy25e0PEIrRDPpvyYhhgHkuNieMEPi/72m0yQbELS3 Vx/zHqNZOuDe9aQy/oS3Mj/vjL+Yhw== X-Received: by 2002:a05:6512:1384:b0:5c1:7da5:7171 with SMTP id 2adb3069b0e04-5c1bc844a07mr10352910e87.56.1795980961531; Sun, 29 Nov 2026 11:36:01 -0800 (PST) Received: from [127.0.1.1] ([5.195.0.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5c1bd043420sm7561895e87.57.2026.11.29.11.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 11:36:01 -0800 (PST) From: Jiawen Liu To: Krzysztof Kozlowski , Peter Griffin , Greg Kroah-Hartman , Jiri Slaby Cc: Alim Akhtar , 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 Message-ID: <179598034086.2.8243056622030752053.pattern-ext-118.18@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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 --- 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