Skip to content

Commit

Permalink
net: dsa: microchip: lan937x: fix reference count leak in lan937x_mdi…
Browse files Browse the repository at this point in the history
…o_register()

This node pointer is returned by of_find_compatible_node() with
refcount incremented in this function. of_node_put() on it before
exitting this function.

Fixes: c9cd961 ("net: dsa: microchip: lan937x: add interrupt support for port phy link")
Signed-off-by: Sun Ke <sunke32@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20220908040226.871690-1-sunke32@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Sun Ke authored and Jakub Kicinski committed Sep 19, 2022
1 parent 42666b2 commit 2f8a786
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/dsa/microchip/lan937x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@ static int lan937x_mdio_register(struct ksz_device *dev)
ds->slave_mii_bus = bus;

ret = lan937x_irq_phy_setup(dev);
if (ret)
if (ret) {
of_node_put(mdio_np);
return ret;
}

ret = devm_of_mdiobus_register(ds->dev, bus, mdio_np);
if (ret) {
Expand Down

0 comments on commit 2f8a786

Please sign in to comment.