mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
Merge branch 'more-phydev-leaks'
Johan Hovold says: ==================== net: fix phydev reference leaks This series fixes a number of phydev reference leaks (and one of_node leak) due to failure to put the reference taken by of_phy_find_device(). Note that I did not try to fix drivers/net/phy/xilinx_gmii2rgmii.c which still leaks a reference. Against net but should apply just as fine to net-next. v2: - use put_device() instead of phy_dev_free() to put the references taken in net/dsa (patch 1/4). - add four new patches fixing similar leaks ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
a1cad5ee80
@ -542,8 +542,10 @@ static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv)
|
||||
/* Make sure we initialize MoCA PHYs with a link down */
|
||||
if (phy_mode == PHY_INTERFACE_MODE_MOCA) {
|
||||
phydev = of_phy_find_device(dn);
|
||||
if (phydev)
|
||||
if (phydev) {
|
||||
phydev->link = 0;
|
||||
put_device(&phydev->mdio.dev);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1107,6 +1107,9 @@ int memac_free(struct fman_mac *memac)
|
||||
{
|
||||
free_init_resources(memac);
|
||||
|
||||
if (memac->pcsphy)
|
||||
put_device(&memac->pcsphy->mdio.dev);
|
||||
|
||||
kfree(memac->memac_drv_param);
|
||||
kfree(memac);
|
||||
|
||||
|
@ -892,6 +892,8 @@ static int mac_probe(struct platform_device *_of_dev)
|
||||
priv->fixed_link->duplex = phy->duplex;
|
||||
priv->fixed_link->pause = phy->pause;
|
||||
priv->fixed_link->asym_pause = phy->asym_pause;
|
||||
|
||||
put_device(&phy->mdio.dev);
|
||||
}
|
||||
|
||||
err = mac_dev->init(mac_dev);
|
||||
|
@ -212,6 +212,7 @@ int emac_phy_config(struct platform_device *pdev, struct emac_adapter *adpt)
|
||||
|
||||
phy_np = of_parse_phandle(np, "phy-handle", 0);
|
||||
adpt->phydev = of_phy_find_device(phy_np);
|
||||
of_node_put(phy_np);
|
||||
}
|
||||
|
||||
if (!adpt->phydev) {
|
||||
|
@ -711,6 +711,8 @@ static int emac_probe(struct platform_device *pdev)
|
||||
err_undo_napi:
|
||||
netif_napi_del(&adpt->rx_q.napi);
|
||||
err_undo_mdiobus:
|
||||
if (!has_acpi_companion(&pdev->dev))
|
||||
put_device(&adpt->phydev->mdio.dev);
|
||||
mdiobus_unregister(adpt->mii_bus);
|
||||
err_undo_clocks:
|
||||
emac_clks_teardown(adpt);
|
||||
@ -730,6 +732,8 @@ static int emac_remove(struct platform_device *pdev)
|
||||
|
||||
emac_clks_teardown(adpt);
|
||||
|
||||
if (!has_acpi_companion(&pdev->dev))
|
||||
put_device(&adpt->phydev->mdio.dev);
|
||||
mdiobus_unregister(adpt->mii_bus);
|
||||
free_netdev(netdev);
|
||||
|
||||
|
@ -233,6 +233,8 @@ int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev,
|
||||
genphy_read_status(phydev);
|
||||
if (ds->ops->adjust_link)
|
||||
ds->ops->adjust_link(ds, port, phydev);
|
||||
|
||||
put_device(&phydev->mdio.dev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -509,8 +511,9 @@ void dsa_cpu_dsa_destroy(struct device_node *port_dn)
|
||||
if (of_phy_is_fixed_link(port_dn)) {
|
||||
phydev = of_phy_find_device(port_dn);
|
||||
if (phydev) {
|
||||
phy_device_free(phydev);
|
||||
fixed_phy_unregister(phydev);
|
||||
put_device(&phydev->mdio.dev);
|
||||
phy_device_free(phydev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user