net: qcom/emac: grab a reference to the phydev on ACPI systems
Commit 6ffe1c4cd0
("net: qcom/emac: fix of_node and phydev leaks")
fixed the problem with reference leaks on phydev, but the fix is
device-tree specific. When the driver unloads, the reference is
dropped only on DT systems.
Instead, it's cleaner if up grab an reference on ACPI systems.
When the driver unloads, we can drop the reference without having
to check whether we're on a DT system.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -201,6 +201,13 @@ int emac_phy_config(struct platform_device *pdev, struct emac_adapter *adpt)
|
||||
else
|
||||
adpt->phydev = mdiobus_get_phy(mii_bus, phy_addr);
|
||||
|
||||
/* of_phy_find_device() claims a reference to the phydev,
|
||||
* so we do that here manually as well. When the driver
|
||||
* later unloads, it can unilaterally drop the reference
|
||||
* without worrying about ACPI vs DT.
|
||||
*/
|
||||
if (adpt->phydev)
|
||||
get_device(&adpt->phydev->mdio.dev);
|
||||
} else {
|
||||
struct device_node *phy_np;
|
||||
|
||||
|
Reference in New Issue
Block a user