[PATCH] phy: hisilicon: add missing call to of_node_put()

From: Yang Li
Date: Mon Mar 08 2021 - 02:11:16 EST


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.

Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
Signed-off-by: Yang Li <yang.lee@xxxxxxxxxxxxxxxxx>
---
drivers/phy/hisilicon/phy-hisi-inno-usb2.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
index 34a6a9a..c58115e 100644
--- a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
+++ b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
@@ -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]);
--
1.8.3.1