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=1796389776; b=uPbWqyvq5KrcY7kraf9XsHwcmIZEXIR53fHMiecEwHR5xARWt8jsweDhsV88p6o5JKvX S4/KCetrW4i9dt5VHrpMbc6Zk+6sLEPnAsp3gWlArg0w2lgtwVAxfwzyO98zEoRnAtp7E WCN+VQfUbg10g78ZyUtsxuxU7l3pykyj7+deBidpPkwdvA2sNVgDInyZuNT/miUwSg3BG qyxtdRZZfynXtY9pRuqgHTL13uENSbzZcWqa639Hm/+7a+K78hGYB27aLGRIDG2m8bPR6 +SZxrKFALA4mlK3oLQSwgAej9dDphZnKT+BvM48wKPGllYYCyPqfYMsPFiCpkWiwRQA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389776; 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=LTXgS543mUmz2dVbBKcBfq0vUAdRcAxsUpiCyg0+TIA=; b=beCY90SQiG/+DQR3HgiePwjIZwiCCkKKuyLLrsJ4yPBjWwj79XTrLLAEIUBcWZHAxJ2k w2gAcTtib2L7e9bx4wM0GwqScp8X/QfOW3ZlPM+YcD6CkUYEe9JdY4+EgkEV1UhvgbOVZ q0z181U66cjI9CPz/A9EOMc6qt5CD63+i9LmNZKG6JU3xKCWQ3qZ0dgFqNeFNh3RCkM5W hd353VY+UIkN8GqwHWk+mk0MnDI6gtEvsX+6UVM5027PRBUaXcocyFfIT2RzGWLOw1A5a W1LNHl5n9IpfunkRVkHuLQTvdMGa3xu4dytnGv80mM1R8m1oEU0BlDTM9KzpNwvqRpQ== 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=PnquppnO; 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 D0E6E606A322; Fri, 4 Dec 2026 13:09:36 +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=PnquppnO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 464731F000C2; Fri, 4 Dec 2026 13:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389776; bh=LTXgS543mUmz2dVbBKcBfq0vUAdRcAxsUpiCyg0+TIA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PnquppnOjwUUZ8Q9VgGOzwce9pStjM4C6Sd2/xTGvxQUgeLe6V7mS4+t1ObcD+wbm PKM0PxEMHtWgPHVX7+OLOXUZhSR1qVGtWp5BmyF/VpqW2rM13CXQsoleevnCQWiKkR GnNsV0/BLGOUzVfpcrh7mAyb62mbZKkSb/RsK+QM= 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 6.1 0786/1059] phy: ti-pipe3: Fix clock leaks in init/exit error paths Date: Fri, 4 Dec 2026 19:05:17 +0900 Message-ID: <20261204100704.391460966@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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 690615ff5c804..d4dad818cdd51 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