aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/phy/phy-miphy28lp.c
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2015-11-16 06:33:18 -0500
committerKishon Vijay Abraham I <kishon@ti.com>2015-12-03 01:58:23 -0500
commit7fd7fa43f4f7b1ce9ef0070256530dab6726ef08 (patch)
tree854775f5f1e537ec65a8f73d38375c0bed846fee /drivers/phy/phy-miphy28lp.c
parentf6f31af81c77087c8884f5dc1ab91b029cd11842 (diff)
phy: miphy28lp: add missing of_node_put
for_each_child_of_node performs an of_node_get on each iteration, so a return from the middle of the loop requires an of_node_put. A simplified version of the semantic patch that finds this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ expression root,e; local idexpression child; @@ for_each_child_of_node(root, child) { ... when != of_node_put(child) when != e = child ( return child; | * return ...; ) ... } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy/phy-miphy28lp.c')
-rw-r--r--drivers/phy/phy-miphy28lp.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c
index c47b56b4a2b8..3acd2a1808df 100644
--- a/drivers/phy/phy-miphy28lp.c
+++ b/drivers/phy/phy-miphy28lp.c
@@ -1226,15 +1226,18 @@ static int miphy28lp_probe(struct platform_device *pdev)
1226 1226
1227 miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy), 1227 miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy),
1228 GFP_KERNEL); 1228 GFP_KERNEL);
1229 if (!miphy_phy) 1229 if (!miphy_phy) {
1230 return -ENOMEM; 1230 ret = -ENOMEM;
1231 goto put_child;
1232 }
1231 1233
1232 miphy_dev->phys[port] = miphy_phy; 1234 miphy_dev->phys[port] = miphy_phy;
1233 1235
1234 phy = devm_phy_create(&pdev->dev, child, &miphy28lp_ops); 1236 phy = devm_phy_create(&pdev->dev, child, &miphy28lp_ops);
1235 if (IS_ERR(phy)) { 1237 if (IS_ERR(phy)) {
1236 dev_err(&pdev->dev, "failed to create PHY\n"); 1238 dev_err(&pdev->dev, "failed to create PHY\n");
1237 return PTR_ERR(phy); 1239 ret = PTR_ERR(phy);
1240 goto put_child;
1238 } 1241 }
1239 1242
1240 miphy_dev->phys[port]->phy = phy; 1243 miphy_dev->phys[port]->phy = phy;
@@ -1242,11 +1245,11 @@ static int miphy28lp_probe(struct platform_device *pdev)
1242 1245
1243 ret = miphy28lp_of_probe(child, miphy_phy); 1246 ret = miphy28lp_of_probe(child, miphy_phy);
1244 if (ret) 1247 if (ret)
1245 return ret; 1248 goto put_child;
1246 1249
1247 ret = miphy28lp_probe_resets(child, miphy_dev->phys[port]); 1250 ret = miphy28lp_probe_resets(child, miphy_dev->phys[port]);
1248 if (ret) 1251 if (ret)
1249 return ret; 1252 goto put_child;
1250 1253
1251 phy_set_drvdata(phy, miphy_dev->phys[port]); 1254 phy_set_drvdata(phy, miphy_dev->phys[port]);
1252 port++; 1255 port++;
@@ -1255,6 +1258,9 @@ static int miphy28lp_probe(struct platform_device *pdev)
1255 1258
1256 provider = devm_of_phy_provider_register(&pdev->dev, miphy28lp_xlate); 1259 provider = devm_of_phy_provider_register(&pdev->dev, miphy28lp_xlate);
1257 return PTR_ERR_OR_ZERO(provider); 1260 return PTR_ERR_OR_ZERO(provider);
1261put_child:
1262 of_node_put(child);
1263 return ret;
1258} 1264}
1259 1265
1260static const struct of_device_id miphy28lp_of_match[] = { 1266static const struct of_device_id miphy28lp_of_match[] = {