Skip to contentSkip to conversation

phy: hisilicon: add missing call to of_node_put()

PATCH New Yang Li 1 participant 1 message Mar 8, 2021 Generic PHY framework

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 phy: hisilicon: add missing call to of_node_put()

In one of the error paths of the for_each_child_of_node() loop, add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/phy/hisilicon/phy-hisi-inno-usb2.c:138:1-23: WARNING: Function "for_each_child_of_node" should have of_node_put() before break around line 158.

---
 drivers/phy/hisilicon/phy-hisi-inno-usb2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/phy/hisilicon/phy-hisi-inno-usb2.c +3 -1
index 34a6a9a..c58115e 100644
@@ -146,8 +146,10 @@ static int hisi_inno_phy_probe(struct platform_device *pdev)
 		priv->ports[i].priv = priv;
 
 		phy = devm_phy_create(dev, child, &hisi_inno_phy_ops);
-		if (IS_ERR(phy))
+		if (IS_ERR(phy)) {
+			of_node_put(child);
 			return PTR_ERR(phy);
+		}
 
 		phy_set_bus_width(phy, 8);
 		phy_set_drvdata(phy, &priv->ports[i]);
Signature · 1 line
1.8.3.1