Commit 30563f93 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents cfc44a4d 13c9d934
...@@ -279,7 +279,7 @@ EXPORT_SYMBOL_GPL(fixed_phy_register); ...@@ -279,7 +279,7 @@ EXPORT_SYMBOL_GPL(fixed_phy_register);
void fixed_phy_unregister(struct phy_device *phy) void fixed_phy_unregister(struct phy_device *phy)
{ {
phy_device_remove(phy); phy_device_remove(phy);
of_node_put(phy->mdio.dev.of_node);
fixed_phy_del(phy->mdio.addr); fixed_phy_del(phy->mdio.addr);
} }
EXPORT_SYMBOL_GPL(fixed_phy_unregister); EXPORT_SYMBOL_GPL(fixed_phy_unregister);
......
...@@ -292,6 +292,7 @@ struct phy_device *of_phy_find_device(struct device_node *phy_np) ...@@ -292,6 +292,7 @@ struct phy_device *of_phy_find_device(struct device_node *phy_np)
mdiodev = to_mdio_device(d); mdiodev = to_mdio_device(d);
if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY)
return to_phy_device(d); return to_phy_device(d);
put_device(d);
} }
return NULL; return NULL;
...@@ -456,8 +457,11 @@ int of_phy_register_fixed_link(struct device_node *np) ...@@ -456,8 +457,11 @@ int of_phy_register_fixed_link(struct device_node *np)
status.link = 1; status.link = 1;
status.duplex = of_property_read_bool(fixed_link_node, status.duplex = of_property_read_bool(fixed_link_node,
"full-duplex"); "full-duplex");
if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) if (of_property_read_u32(fixed_link_node, "speed",
&status.speed)) {
of_node_put(fixed_link_node);
return -EINVAL; return -EINVAL;
}
status.pause = of_property_read_bool(fixed_link_node, "pause"); status.pause = of_property_read_bool(fixed_link_node, "pause");
status.asym_pause = of_property_read_bool(fixed_link_node, status.asym_pause = of_property_read_bool(fixed_link_node,
"asym-pause"); "asym-pause");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment