net: phy: add a note about refcounting
Subsystems (3)
PATCH 1/1 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.
--- drivers/net/phy/mdio_bus.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/phy/mdio_bus.c +3 -0
@@ -460,6 +460,9 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus,if (addr == mdiodev->addr) {device_set_node (dev,of_fwnode_handle (child)); +/* The refcount on "child" is passed to the mdio +* device. Do _not_ use of_node_put(child) here. +*/ return ; } }
Signature · 1 line
2.30.2
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 10 lines · On Mon, 13 Dec 2021 11:05:13 +0000 you wrote:
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.[...]
Here is the summary with links:
- [net] net: phy: add a note about refcounting
https://git.kernel.org/netdev/net/c/d33dae51645c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html