diff mbox series

net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe

Message ID 20221229062925.1372931-1-linmq006@gmail.com (mailing list archive)
State New, archived
Headers show
Series net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe | expand

Commit Message

Miaoqian Lin Dec. 29, 2022, 6:29 a.m. UTC
of_phy_find_device() return device node with refcount incremented.
Call put_device() to relese it when not needed anymore.

Fixes: ab4e6ee578e8 ("net: phy: xgmiitorgmii: Check phy_driver ready before accessing")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/net/phy/xilinx_gmii2rgmii.c | 1 +
 1 file changed, 1 insertion(+)

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 30, 2022, 7:50 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 29 Dec 2022 10:29:25 +0400 you wrote:
> of_phy_find_device() return device node with refcount incremented.
> Call put_device() to relese it when not needed anymore.
> 
> Fixes: ab4e6ee578e8 ("net: phy: xgmiitorgmii: Check phy_driver ready before accessing")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/net/phy/xilinx_gmii2rgmii.c | 1 +
>  1 file changed, 1 insertion(+)

Here is the summary with links:
  - net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe
    https://git.kernel.org/netdev/net/c/d039535850ee

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index 8dcb49ed1f3d..7fd9fe6a602b 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -105,6 +105,7 @@  static int xgmiitorgmii_probe(struct mdio_device *mdiodev)
 
 	if (!priv->phy_dev->drv) {
 		dev_info(dev, "Attached phy not ready\n");
+		put_device(&priv->phy_dev->mdio.dev);
 		return -EPROBE_DEFER;
 	}