From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796389757; b=Rdmq1o/MAU11q7dlaaHrp98T5QIqP0CFzlykXDoAu+HG7ttyBpFHmEPf+R+bkDVI3T5C u2xhOk7zQsab24IADEcPG0v3K5TGStWQkIZHJGG0Gc+X79TBdayWZmxdxx5fexMok7QjF fsPDRC/uYC1mClJ8+0gciLHnL2dO5ppwhktfa9Iptcosj9HnyP0ZIt5lSAAt1Z50T5+U5 zbTSRgl3rgez2kJtluWnitupqKGyxRzmdgKKoKVUGq85H19LFS5fdueh1aoa3PiZ+TfXX Suh+RWRVrQjzzqAiy8FCkNPCLM7vbf0cQpEMWoOReVqkmTAtZPwlW+0sMVTIOF6vHVQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389757; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=djcu9bt6UCNgeiFWGXdluWqtyXEeN90m4t6ZI1XFDIo=; b=AugckaD6wr7TSiR75SdRuNhR3RkJ5QxivzHTwboDvwOJ2Zi8hq9jxJwieiXpgly8H6+Q cY/uN6hlueoQBiqDcW8oK/OT3M//+78Cl6e4tAi/mYto1DVNn9ymMRAX+99uev9Smb9vq TgpCB1I5kebldS/zazosKpGDGis7YxbJvQ3TQn0d2AseCigDgi+xjGMquGC/Z4pmOv/7c tO+4ybu+FgRqiLLDi7IPxahtCEiVAuL8LYJVaNIhASzYiwWHtygcRy0PUp3k8x54WoeIG DF4EYHFw4WIAkpozmDJd7w4ZfBwvef4qdj+ZVnl8qisgRUblp5kMd8JdsHhMRrYZolQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=ug3p1ESs; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C15C606A322; Fri, 4 Dec 2026 13:09:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=ug3p1ESs Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68A501F00897; Fri, 4 Dec 2026 13:09:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389756; bh=djcu9bt6UCNgeiFWGXdluWqtyXEeN90m4t6ZI1XFDIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ug3p1ESstcJH8DhnnYbwb2biRCCKqbbuPlmZMVYiz8CaBjeL9YuOakjpAzm3JFXux ouGXFwWZZAWSdO2/j/KeRw3GTXnJkF5morLEiTD8sdka9v7+4+ROZL57QeLl7i7PCh AvavuZyY6UXjcP4EYeshArM0zeDUcW1nBkbNeVRE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hongling Zeng , Manivannan Sadhasivam , Vinod Koul , Sasha Levin Subject: [PATCH 7.3 082/742] phy: ti-pipe3: Fix clock leaks in init/exit error paths Date: Fri, 4 Dec 2026 18:59:06 +0900 Message-ID: <20261204100637.287412504@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hongling Zeng [ Upstream commit 2be6a65608a5e32b2be6f5da843b1f29f1091098 ] Two paths return without disabling the clocks that ti_pipe3_init() has just enabled, leaking clock enable references: 1. In ti_pipe3_init(), when regmap_update_bits() fails for PCIe mode, the function returns the error without calling ti_pipe3_disable_clocks(). The clocks stay permanently enabled since the PHY framework won't invoke the .exit callback on init failure. 2. In ti_pipe3_exit(), when the PHY is in SATA mode without dpll_reset_syscon, the function returns 0 early to avoid powering down the SATA DPLL (Errata i783), which also skips the ti_pipe3_disable_clocks() at the end of the function. Every init/exit cycle therefore leaks the clock enable reference taken in ti_pipe3_init(). Fix both by adding the missing ti_pipe3_disable_clocks() calls, consistent with how the DPLL program error path handles cleanup. Fixes: 234738ea3390 ("phy: ti-pipe3: move clk initialization to a separate function") Fixes: 0a0830feb2ad ("phy: ti-pipe3: fix suspend") Reported-by: Sashiko AI Closes: https://lore.kernel.org/all/20260518023657.41852C2BCB0@smtp.kernel.org/ Signed-off-by: Hongling Zeng Reviewed-by: Manivannan Sadhasivam Link: https://patch.msgid.link/20260909122630.1313205-5-zenghongling@kylinos.cn Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/ti/phy-ti-pipe3.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c index fdd81c935e5f3..0d4a49a3f0c79 100644 --- a/drivers/phy/ti/phy-ti-pipe3.c +++ b/drivers/phy/ti/phy-ti-pipe3.c @@ -518,6 +518,8 @@ static int ti_pipe3_init(struct phy *x) val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT; ret = regmap_update_bits(phy->pcs_syscon, phy->pcie_pcs_reg, PCIE_PCS_MASK, val); + if (ret) + ti_pipe3_disable_clocks(phy); return ret; } @@ -555,8 +557,10 @@ static int ti_pipe3_exit(struct phy *x) /* If dpll_reset_syscon is not present we wont power down SATA DPLL * due to Errata i783 */ - if (phy->mode == PIPE3_MODE_SATA && !phy->dpll_reset_syscon) + if (phy->mode == PIPE3_MODE_SATA && !phy->dpll_reset_syscon) { + ti_pipe3_disable_clocks(phy); return 0; + } /* PCIe doesn't have internal DPLL */ if (phy->mode != PIPE3_MODE_PCIE) { -- 2.53.0