Skip to content

Commit d33dae5

Browse files
Russell King (Oracle)davem330
authored andcommitted
net: phy: add a note about refcounting
Recently, a patch has been submitted to "fix" the refcounting for a DT node in of_mdiobus_link_mdiodev(). This is not a leaked refcount. The refcount is passed to the new device. Sadly, coccicheck identifies this location as a leaked refcount, which means we're likely to keep getting patches to "fix" this. However, fixing this will cause breakage. Add a comment to state that the lack of of_node_put() here is intentional. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent be565ec commit d33dae5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/phy/mdio_bus.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,9 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus,
460460

461461
if (addr == mdiodev->addr) {
462462
device_set_node(dev, of_fwnode_handle(child));
463+
/* The refcount on "child" is passed to the mdio
464+
* device. Do _not_ use of_node_put(child) here.
465+
*/
463466
return;
464467
}
465468
}

0 commit comments

Comments
 (0)