net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe
authorMiaoqian Lin <linmq006@gmail.com>
Thu, 29 Dec 2022 06:29:25 +0000 (10:29 +0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 30 Dec 2022 07:46:10 +0000 (07:46 +0000)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/xilinx_gmii2rgmii.c

index 8dcb49e..7fd9fe6 100644 (file)
@@ -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;
        }