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=1796381828; b=Eb4WMjJDNho4oA0/1ibfj7BUFTjyQ4/DINslAcxvhikoMNcs4IpQb2h80wy6hvg7nVMQ KYHpCoAub6z2BFfv0bmHIDFGhpp9CW5kNExfBm13mgoTR4QiNLO9EM6JAm0F6anLmxf6F nhU1aD/oLDPpHtGeeEQG5P4Bmgy4+rwDIMMRDVXv3abyO1z/AQ7fg3F/XMCwPOl8/t8qH s7kQetmNELSRedaCcp0H1FC2K7Kp/TRCAFKS2k/emnZUKalm9S7y3e6HBYkDM04AvG/+u XB8m3LU9RY1Tzp0pTFP8cYoMClG9Ru2+glqDGTmKElgV6eikpsDQT+pGbBguEByEnOw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381828; 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=DBYM8updvbOifPBPciVf8RX0U5mnaMJfpWKXRbi46Qw=; b=xtz6RBpZu3rQ8lMp4Gd/HYqbpL57JSJiZXifQ8AMWiYOxCsGtFRGgUHN0Slzvu2WOHKR TPiER0Hf1frCgQDqfmKadOyJnfAR8enHf0spMThzJ7Yg2T0/i8Up8/sbqqaYeikLolLEZ drPLH8SbupcO5sAsQNwlF147XFC0U7j77ePLZNubtZnqaTDqfOjvpY/kzhaDCwO+HsspJ rUnKke7EWHeuFDI2u61fSQs/tkH9CNBSKfDGxO+xQPbziWqurDNv2jZ0cX8ba6vxKK0Ig DibsZyCCZYa+P/0dxY/LeXjYemFKr0nONOVVxYyAQ87in0SVJOhtqYS/FxSqCC5r3TA== 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=fA2PJYVu; 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 59803606A322; Fri, 4 Dec 2026 10:57:08 +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=fA2PJYVu Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8C7C1F000CE; Fri, 4 Dec 2026 10:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381828; bh=DBYM8updvbOifPBPciVf8RX0U5mnaMJfpWKXRbi46Qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fA2PJYVua5uLGfG40d9pg+o84N2+3c1M5C0rlCOe4vuKn2THrGq5hTKZHMP8rw8Jr 0PPuTkWDfAYsOpzEa4d8EE7yV04VxlcgoICSjssdwBjn1B12i4xkIcPz0PxjdoNeMu s0GAVRTVqSX/N+w8heA1c8cg5uV9+jNtDvaYpexU= 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 140/703] phy: ti: pipe3: Fix clock resource leak on probe errors Date: Fri, 4 Dec 2026 19:00:39 +0900 Message-ID: <20261204100631.610758781@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 6dc01e3516d79cf4d690d892499a0bd08a14285b ] When devm_phy_create() or devm_of_phy_provider_register() fails, the refclk that was enabled earlier is not disabled, causing a resource leak. Fix this by adding an error handling path to disable the clock when these functions fail. Fixes: 234738ea3390 ("phy: ti-pipe3: move clk initialization to a separate function") Signed-off-by: Hongling Zeng Reviewed-by: Manivannan Sadhasivam Link: https://patch.msgid.link/20260909122630.1313205-3-zenghongling@kylinos.cn Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/ti/phy-ti-pipe3.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c index 0e3bc92187338..021657cbce481 100644 --- a/drivers/phy/ti/phy-ti-pipe3.c +++ b/drivers/phy/ti/phy-ti-pipe3.c @@ -834,21 +834,39 @@ static int ti_pipe3_probe(struct platform_device *pdev) */ if (phy->mode == PIPE3_MODE_SATA) { if (!IS_ERR(phy->refclk)) { - clk_prepare_enable(phy->refclk); + ret = clk_prepare_enable(phy->refclk); + if (ret) { + dev_err(dev, "Failed to enable refclk %d\n", ret); + goto err_pm_disable; + } phy->sata_refclk_enabled = true; } } generic_phy = devm_phy_create(dev, NULL, &ops); - if (IS_ERR(generic_phy)) - return PTR_ERR(generic_phy); + if (IS_ERR(generic_phy)) { + ret = PTR_ERR(generic_phy); + goto err_clk_disable; + } phy_set_drvdata(generic_phy, phy); ti_pipe3_power_off(generic_phy); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); - return PTR_ERR_OR_ZERO(phy_provider); + if (IS_ERR(phy_provider)) { + ret = PTR_ERR(phy_provider); + goto err_clk_disable; + } + + return 0; + +err_clk_disable: + if (phy->sata_refclk_enabled) + clk_disable_unprepare(phy->refclk); +err_pm_disable: + pm_runtime_disable(dev); + return ret; } static void ti_pipe3_remove(struct platform_device *pdev) -- 2.53.0