From nobody Fri Jun 12 15:51:47 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 A18C3248867 for ; Thu, 14 May 2026 02:34:35 +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=1778726078; cv=none; b=eCkeIAu56GvSAEI2Ye4cOsNn2t0Ei/MFOuezB7ABqgsULU/KYyMCaxWeSB+4ZwHcwIhM0ln2tzoBmP1+CrRKeZLn9H+0/npbtukI03Z05F2J5i4GR5Mb0ORb1tcG7SvV6bAkWaWF/f4iB2fcMWy3p3rt5JaT2xka1AEpMoL837A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778726078; c=relaxed/simple; bh=HKDC8kSp0+JxXdxn0mkQ/39XDkv34aP37jgYTYBkDiM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=UCSCjFSjad9YSR0XaUcWBjYMvR7eqgugH1rwDtn8Q01NFQHSqCYHpWAV3qAaGcyJs8tcUMtep5IKREH+2DB+zYXCZJCE5W9NkRbv5VNzZ2Br7kaKpLNy0zufnJMu/mFZWuKqSozsdtZZ5yPg77mcAokaaO5BgJ02dCy0hjUObEU= 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: 6f3892a04f3d11f1aa26b74ffac11d73-20260514 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:75b06bdf-6672-4d2a-a814-b29b7c618744,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:ec3ba9be534980246a388f6851caeb4b,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: 6f3892a04f3d11f1aa26b74ffac11d73-20260514 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 1144827355; Thu, 14 May 2026 10:34:30 +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 v2] phy: ti: pipe3: Fix clock resource leak on probe errors Date: Thu, 14 May 2026 10:34:24 +0800 Message-Id: <20260514023424.23815-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 v2: -Add pm_runtime_disable() in error path (reported by Sashiko AI). --- drivers/phy/ti/phy-ti-pipe3.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c index b5543b5c674c..5f4a81f6d2b9 100644 --- a/drivers/phy/ti/phy-ti-pipe3.c +++ b/drivers/phy/ti/phy-ti-pipe3.c @@ -837,15 +837,28 @@ 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: + pm_runtime_disable(dev); + 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