From nobody Fri Jun 12 18:36:26 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D3E13E9C32 for ; Wed, 13 May 2026 09:44:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778665457; cv=none; b=hv/HFSc+QepUU0LHcEZMgnP6hhX/zw1XFQm+9kP1oye/HYGCpzibE8zfZedwKBMNzw55Ma1Xrg59MRXstcz8jaiXgGXiRuYNPq+3Acd8yYkJ7epFBUokd0cGnM3xnLlRqZFlLm2acOWdao4ek3flShrWjBM99o1zrlkyei1AVeM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778665457; c=relaxed/simple; bh=Ko7pwEzewZoe5S3qTflClXNFgtzKBxFhqkzxbOQFeEE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=CMU3q4Kgf7beZ6Z4MiKLm5KHrsjpKfXXivS+4j1XfaQi1lXYwt5+x47jD2vXL0yhHLYofRu0Kv1CJp01oadlVjYhH8gV45nxL9WL3DaIDawJSaItRgtPaMF/mSNLBNyVmCOcz9cFhi14ENEPPEBEK1C9/botlXVKOWkoMFnPazc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 468921a44eb011f1aa26b74ffac11d73-20260513 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:2ba5ba40-c621-4c92-815a-35bc049c17ed,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:e7bac3a,CLOUDID:d357f912e48cd56888a57cb57a012bea,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:102|850|898,TC:nil,Content:0|15|50,EDM:- 3,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,A V:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 468921a44eb011f1aa26b74ffac11d73-20260513 X-User: zenghongling@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 850591892; Wed, 13 May 2026 17:44:02 +0800 From: Hongling Zeng To: vkoul@kernel.org, neil.armstrong@linaro.org, johan@kernel.org, kishon@kernel.org Cc: linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, zhongling0719@126.com, Hongling Zeng Subject: [PATCH v1] phy: ti: pipe3: Fix clock resource leak on probe errors Date: Wed, 13 May 2026 17:43:57 +0800 Message-Id: <20260513094357.181676-1-zenghongling@kylinos.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- Change in v1: -correct the fix tag. --- --- drivers/phy/ti/phy-ti-pipe3.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c index b5543b5c674c..29a4cbe73781 100644 --- a/drivers/phy/ti/phy-ti-pipe3.c +++ b/drivers/phy/ti/phy-ti-pipe3.c @@ -837,15 +837,27 @@ static int ti_pipe3_probe(struct platform_device *pde= v) } =20 generic_phy =3D devm_phy_create(dev, NULL, &ops); - if (IS_ERR(generic_phy)) - return PTR_ERR(generic_phy); + if (IS_ERR(generic_phy)) { + ret =3D PTR_ERR(generic_phy); + goto err_clk_disable; + } =20 phy_set_drvdata(generic_phy, phy); =20 ti_pipe3_power_off(generic_phy); =20 phy_provider =3D devm_of_phy_provider_register(dev, of_phy_simple_xlate); - return PTR_ERR_OR_ZERO(phy_provider); + if (IS_ERR(phy_provider)) { + ret =3D PTR_ERR(phy_provider); + goto err_clk_disable; + } + + return 0; + +err_clk_disable: + if (phy->sata_refclk_enabled) + clk_disable_unprepare(phy->refclk); + return ret; } =20 static void ti_pipe3_remove(struct platform_device *pdev) --=20 2.25.1