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=1796386283; b=AZURRQ9/GVw4lT5TEQKdOaMLmQ52ln21DamWxNjdJGW7n5OkFCJZqYcAp8c1vue4eEch C/7/ZZpjRuFP3fl1rYyy7dmY7QM2uNg0PLNLl9cvHOHHroJxZJO1uuuU0PUQ0iEIMmfWA 3YCH5Md/NkDAxJ3PPE4i6oABxHS4eS+dtDvxXyamjCM/tPUCwHVLccNHK+016hY4QCt1C 0/sieg5giyBswPmDgnc8gZWB1DRx7hSIer3CWQcEgvaK8bEXV8wRwWkE7b7OagJAiNM5G fPqvtSV4P3sgRkpAWqL6fxDyADX3oNCSCXpY6gECrJuYtDmSWKVhvx4Vcygux+QWZkA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386283; 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=uuy8acEujOwGlRip+bPUzE/b6eYO6UCQC0THvqB/kwo=; b=qpPa9OmwyrdPUi1xwcc49kdSrsHWimTEtZT9rP9R+j31x2OnudvfEABZ160F+OvHTpOq kr+FU5Z2d/IbSZ4a+030gimV1TGuF52kOKzDGlnqNui5IzbLcap6qbxubT8Xu5HXZJm8j H3IJCC6Vkbx0yUaTWDGjcKYYaAiQN7gRDhGeae71W9uFaJ2hjryfUOeQxsggnudSLReQQ ZIzRmFqDSpwjmpXHtCJinKk7B1lPd1wXINvuzDgD9tbzEvnpllNH9uNCTRGNdVtOvbvsO TYwBwFcf/G7c3PqKCvmqY5lFQrgWiZP1dKC+EqM/+s9K8LU5Zx8Ywe1mzFiULzUiPfQ== 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=mD3P1gPv; 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 B667D606A322; Fri, 4 Dec 2026 12:11:23 +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=mD3P1gPv Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14D631F000C2; Fri, 4 Dec 2026 12:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386283; bh=uuy8acEujOwGlRip+bPUzE/b6eYO6UCQC0THvqB/kwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mD3P1gPveupsxmkU4+iek49IllsXIY8qnEQ0gj6qxov3ZMNRi4u8zgAzqof3SWV6d naJmZD9u0jf1BRDzQyKsmRhzoSYcdfjqrQSo5ERXXV8Fy/4MdBbbnnfekkF+B6NyhL diWPgNQ96CzG6nYuD4ZQUuHldG1v/e6cEmRk4/HE= 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 0857/1167] phy: ti: pipe3: Fix clock resource leak on probe errors Date: Fri, 4 Dec 2026 19:04:44 +0900 Message-ID: <20261204100724.439815857@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: 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.6-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 91604c96f2294..de0c045f655c0 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