aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2016-11-16 09:20:36 -0500
committerDavid S. Miller <davem@davemloft.net>2016-11-17 12:05:04 -0500
commit48c1699d5335bc045b50989a06b1c526b17a25ff (patch)
tree5075ac7364141e1e8d853d9b8b9219917aa56b07
parentcfc44a4d147ea605d66ccb917cc24467d15ff867 (diff)
of_mdio: fix node leak in of_phy_register_fixed_link error path
Make sure to drop the of_node reference also on failure to parse the speed property in of_phy_register_fixed_link(). Fixes: 3be2a49e5c08 ("of: provide a binding for fixed link PHYs") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/of/of_mdio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index b470f7e3521d..8f4648383fb2 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -456,8 +456,11 @@ int of_phy_register_fixed_link(struct device_node *np)
456 status.link = 1; 456 status.link = 1;
457 status.duplex = of_property_read_bool(fixed_link_node, 457 status.duplex = of_property_read_bool(fixed_link_node,
458 "full-duplex"); 458 "full-duplex");
459 if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) 459 if (of_property_read_u32(fixed_link_node, "speed",
460 &status.speed)) {
461 of_node_put(fixed_link_node);
460 return -EINVAL; 462 return -EINVAL;
463 }
461 status.pause = of_property_read_bool(fixed_link_node, "pause"); 464 status.pause = of_property_read_bool(fixed_link_node, "pause");
462 status.asym_pause = of_property_read_bool(fixed_link_node, 465 status.asym_pause = of_property_read_bool(fixed_link_node,
463 "asym-pause"); 466 "asym-pause");