Skip to contentSkip to conversation

phy: ti: am654: Fix a leak in serdes_am654_probe()

PATCH Applied Dan Carpenter 2 participants 2 messages Sep 5, 2020 – Sep 8, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: ti: am654: Fix a leak in serdes_am654_probe()

If devm_phy_create() fails then we need to call of_clk_del_provider(node) to undo the call to of_clk_add_provider().

Fixes 71e2f5c5c224 ("phy: ti: Add a new SERDES driver for TI's AM654x SoC")
---
 drivers/phy/ti/phy-am654-serdes.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/phy/ti/phy-am654-serdes.c +4 -2
index 6f3c11bd65d5..2ff56ce77b30 100644
@@ -822,8 +822,10 @@ static int serdes_am654_probe(struct platform_device *pdev)
 	pm_runtime_enable(dev);
 
 	phy = devm_phy_create(dev, NULL, &ops);
-	if (IS_ERR(phy))
-		return PTR_ERR(phy);
+	if (IS_ERR(phy)) {
+		ret = PTR_ERR(phy);
+		goto clk_err;
+	}
 
 	phy_set_drvdata(phy, am654_phy);
 	phy_provider = devm_of_phy_provider_register(dev, serdes_am654_xlate);
Signature · 1 line
2.28.0
maintainer Applied
#1 lore raw
Quoted 2 lines · Dan Carpenter

If devm_phy_create() fails then we need to call of_clk_del_provider(node) to undo the call to of_clk_add_provider().

Applied, thanks

Signature · 1 line
~Vinod