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=1796389761; b=veENl0hwjvrMNCTDMWCwVpoAy/pxt9rPN72USe14fvVjCIma4JI19BhNVt80oIvnYs2H 3fBS93cvA+Yq7M44DPurtPOSom/uOLwwCX75z4DgfzQHbib/fT5LG02D6lI8uSUNhbNGO RKvqQ8SxiWpoclqklYsvvJUb5mQ6uD5LDX7BP0xgf62s1b7A4k09Y+L/j1gFh28JcPt02 AdTj/xl6eufPkBOfPPFRrOfwMDUBwROV0oXD08XdlshKMEvfC2TSKfsxlJpy3UFI8cOrH xm6EZbCMzVu4JwRI/6SDQ3vuhaYclL0yR70KHPah+giEli3DhxSiivDBqBNZRlhpfmA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389761; 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=V8mNZWi73iSTAw92LPglaEK8TE3cedqJirPIWSNcLjU=; b=pvi6U8GzfPE7eZ0aQADN5Gll/GGjsGWFweHAnNRqn9wOVtbZSWk9P+HcpxCC6fg//G3d yfv3jxbGnMC02Hb8H4oK8Y6Tr+sH3BWfkBktExdCxnwf7QENcq54JONUi8NYjEhQj22q2 jv/QXW3e5Z6rRRFykC71uoKl2AZ6CKQpeg0Nn01A9bmjCi8B/FEx5yHwCOi88SAqvF3v1 HPMjEQnrCNcdEFtluP6zszRKD4WYIj7wGM3ERJQzez9n0yyXJ0utyGvLYHdpCx2dWHNGT n5MoYqz3oXCKlvNbvi6p2Yvjo1phZ7E9ti55870w6GTdqDUymKrBc3yDu//jYyvrHNA== 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=KLaWy0Lx; 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 D3CEA606A322; Fri, 4 Dec 2026 13:09:21 +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=KLaWy0Lx Received: by smtp.kernel.org (Postfix) with ESMTPSA id F409B1F000C2; Fri, 4 Dec 2026 13:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389761; bh=V8mNZWi73iSTAw92LPglaEK8TE3cedqJirPIWSNcLjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KLaWy0Lxl5O7Zi70d2WRX8lv0FwC+EynLNB+js7/sJheKlOQE9XoH7qAkDbSojnbu sn7/wFqEOVjQwN3psPftJkj0SiaOLkVhBYKNIW2phhSw2mkq8bOVFwooMy3ehx2Oc/ OVIMAbRM1pDTHz3OZByD1PG2NUGm7RZdifGBB+Mc= 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.18 142/703] phy: ti-pipe3: Fix clock leaks in init/exit error paths Date: Fri, 4 Dec 2026 19:00:41 +0900 Message-ID: <20261204100631.663669036@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-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