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=1796389766; b=Ro4Mh10vVD61BdF6es3ckCiiQVKC444aTYN1W5UWgN/axovDfF3ctXCZtYIck28g2Q5k 4AQIF8HQ1UVRcVsboalUBhyc665dPDaLO5+h7nZK6uDNhwEB18abh4Dyk4rGRR80QpuTy U+U90DeBiPrDvz3JIZ0pUMFRBnMilzp+m8O5PkjC1FjseZGGJKmH5D5eU7LUqZcLSlV7j YNXsbddAR40LZ7XG5UxfBafZcNy4wLda1uX63+Rj9qvxoheq/dVBwQz2H5DlgSP8rSl8s 1xKJp0a/VuF7U7RexbDIRcYTrpTBTLNBvCrRmEGAik2vyGpskaEQT+qFdv09qg91shg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389766; 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=GconQ+whFlaWs8zr5pHYA7mnP1TXjMtDzoofIve9Boo=; b=HUziAkDvOM9KD4XR32aTVScwE5O/LYRb/XGMZM8K0Etr4UxK7SONyK2mkAa6NoVaABC+ wtTD55iiuBALceSSt+Ec5YckwvQvbi1x/j30/GeoJ+nw0MIk8b6Dq8mKeA+7yImSEyAvr VHnu8rC/3lckCAb2+eyKxpCwKSTH8iI+qC4cvaD15ZjiCk7+4MzYCTL+T/ejecbkT5cwy XIVhSe2vH0afj3Nj2VPGn2XJcOwf4A6z8XVflWW/m810Sm6odGkrQQLU5krcFwS/KJ7eE wJmCNihnX1tGXjY0kDX/eEmzuIRbFVJ+NtEHEAIFsBq+VOnGHriUdUI5Z9LHk6gX55Q== 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=zFQcCptl; 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 A091E606A322; Fri, 4 Dec 2026 13:09:26 +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=zFQcCptl Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BCD11F000CE; Fri, 4 Dec 2026 13:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389766; bh=GconQ+whFlaWs8zr5pHYA7mnP1TXjMtDzoofIve9Boo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zFQcCptl92rWBuh8YeNH6NogXDd5a0et000GI+IkvgJ7ex5JZIkLf9fnpVWlbyyBw 7lNwcJq/aoBxgV4fJ3+s3JbbwWgQA4xDyPOFYVIvtFicilKXirJpTkhYZND+JG/m7g +wy39iAvCaO0EgOQwEMR4aNP31WXQ77F17Bl1pgQ= 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.12 163/555] phy: ti-pipe3: Fix clock leaks in init/exit error paths Date: Fri, 4 Dec 2026 19:03:26 +0900 Message-ID: <20261204100614.435189567@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-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