aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-11-17 12:05:05 -0500
committerDavid S. Miller <davem@davemloft.net>2016-11-17 12:05:05 -0500
commit30563f933a27eb9f9391a0e531dffde5182e422a (patch)
tree381af7ec4c3b40e0955f9cb8fcf42f3a7a1eb0d5
parentcfc44a4d147ea605d66ccb917cc24467d15ff867 (diff)
parent13c9d934a5a1d04f055c20c2253090e9afd9a5d1 (diff)
Merge branch 'phy-dev-leaks'
Johan Hovold says: ==================== net: phy: fix of_node and device leaks These patches fix a couple of of_node leaks in the fixed-link code and a device reference leak in a phy helper. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/fixed_phy.c2
-rw-r--r--drivers/of/of_mdio.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index c649c101bbab..eb5167210681 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -279,7 +279,7 @@ EXPORT_SYMBOL_GPL(fixed_phy_register);
279void fixed_phy_unregister(struct phy_device *phy) 279void fixed_phy_unregister(struct phy_device *phy)
280{ 280{
281 phy_device_remove(phy); 281 phy_device_remove(phy);
282 282 of_node_put(phy->mdio.dev.of_node);
283 fixed_phy_del(phy->mdio.addr); 283 fixed_phy_del(phy->mdio.addr);
284} 284}
285EXPORT_SYMBOL_GPL(fixed_phy_unregister); 285EXPORT_SYMBOL_GPL(fixed_phy_unregister);
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index b470f7e3521d..5a3145a02547 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -292,6 +292,7 @@ struct phy_device *of_phy_find_device(struct device_node *phy_np)
292 mdiodev = to_mdio_device(d); 292 mdiodev = to_mdio_device(d);
293 if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) 293 if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY)
294 return to_phy_device(d); 294 return to_phy_device(d);
295 put_device(d);
295 } 296 }
296 297
297 return NULL; 298 return NULL;
@@ -456,8 +457,11 @@ int of_phy_register_fixed_link(struct device_node *np)
456 status.link = 1; 457 status.link = 1;
457 status.duplex = of_property_read_bool(fixed_link_node, 458 status.duplex = of_property_read_bool(fixed_link_node,
458 "full-duplex"); 459 "full-duplex");
459 if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) 460 if (of_property_read_u32(fixed_link_node, "speed",
461 &status.speed)) {
462 of_node_put(fixed_link_node);
460 return -EINVAL; 463 return -EINVAL;
464 }
461 status.pause = of_property_read_bool(fixed_link_node, "pause"); 465 status.pause = of_property_read_bool(fixed_link_node, "pause");
462 status.asym_pause = of_property_read_bool(fixed_link_node, 466 status.asym_pause = of_property_read_bool(fixed_link_node,
463 "asym-pause"); 467 "asym-pause");