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=1796389769; b=zDKOKxI54JwpnhLM/SVBcElSnP08gC+vYK8Yv/rY2XSv6x/skFWWbrgsnqszA4ize/VV gE53Q7e78v1CW2zHAsGBJmmcktXo+4a3Wmm3/wIa3XNgb0yvydzlgRHSxbSi+A2AhhLD+ 3FO2lCzkGLAcnVF/O9GY4FZxZ2qvu7iueCU2KJj2/Ji8nvUuC0HQxT79F1/A0yc/33ZUr 0wlscjilXi40fZvzcczlfS2jofvw3xWK+luHwINUW7MGiHCCCBgBZ2lx8cTWjKXNWtmlV +RVHkEsxoKM/M7UsI/4j8RylciH2g5pCyeE7Jko4r9UNUYygPLSjl9oPJLY/q//UdNQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389769; 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=ecxdUHCZPUHI2Jg6f60IQgofvUeOk22SIEbGfRYwfgA=; b=xmvrRtCnkGhA+bPu8H5jxkv74SpaupqcE1LRZfduQPpXIyprUbxxovyeo7wtQx7mQbEj 8T/vUOwO17JMBNN1+y+CxHb9ePjkdiofX7sg8SzgANuDZ0CjWPPogVF6gsugc8GKZudHr /UUZClNyPfOrL6WYWU+zueiDQ+HbFxva9HDv3wpNxUluuzPD/wnzFf8cANBRoM78coT4E Oaw/L3OP+dtAK4P5Lg9GdLZ47kdSpXaol0iErCBqjayxaVqtHUXbvCANlX5zp4eAurJTH MC5OGxdXHOhwzTz37UcC6xtZnhgosQh5VETc0DMVZ3s1ZXdsDnMXIRR4YWTvsR6KfjA== 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=pPKMPG2P; 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 6519A606A322; Fri, 4 Dec 2026 13:09:29 +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=pPKMPG2P Received: by smtp.kernel.org (Postfix) with ESMTPSA id B31711F000C2; Fri, 4 Dec 2026 13:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389769; bh=ecxdUHCZPUHI2Jg6f60IQgofvUeOk22SIEbGfRYwfgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pPKMPG2PBIGc1huOf6X8GnzXt1T616wdBHHWt+RdUW8nqY4jG4pLqnuivK6+DKCul 7yoJECjV6O2JwsL3xbv53jZLKOSWJa/Nv16D0y7+yFFE53rumnWyi3x8+f1YejIoBM HYIjgLQne6BHOVAaoGsNkL9fVcRn27vf2ZAzXcNQ= 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.6 0859/1167] phy: ti-pipe3: Fix clock leaks in init/exit error paths Date: Fri, 4 Dec 2026 19:04:46 +0900 Message-ID: <20261204100724.491537526@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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 6.6-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 b2eef24dcd798..6a5e52af46a2c 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