net: ethernet: stmmac: fix of-node and fixed-link-phydev leaks
Make sure to deregister and free any fixed-link phy registered during probe on probe errors and on driver unbind by adding a new glue helper function. Drop the of-node reference taken in the same path also on late probe errors (and not just on driver unbind) by moving the put from stmmac_dvr_remove() to the new helper. Fixes:277323814e
("stmmac: add fixed-link device-tree support") Fixes:4613b279be
("ethernet: stmicro: stmmac: add missing of_node_put after calling of_parse_phandle") Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
661f049be1
commit
d2ed0a7755
@@ -981,12 +981,14 @@ static int rk_gmac_probe(struct platform_device *pdev)
|
||||
plat_dat->resume = rk_gmac_resume;
|
||||
|
||||
plat_dat->bsp_priv = rk_gmac_setup(pdev, data);
|
||||
if (IS_ERR(plat_dat->bsp_priv))
|
||||
return PTR_ERR(plat_dat->bsp_priv);
|
||||
if (IS_ERR(plat_dat->bsp_priv)) {
|
||||
ret = PTR_ERR(plat_dat->bsp_priv);
|
||||
goto err_remove_config_dt;
|
||||
}
|
||||
|
||||
ret = rk_gmac_init(pdev, plat_dat->bsp_priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto err_remove_config_dt;
|
||||
|
||||
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
|
||||
if (ret)
|
||||
@@ -996,6 +998,8 @@ static int rk_gmac_probe(struct platform_device *pdev)
|
||||
|
||||
err_gmac_exit:
|
||||
rk_gmac_exit(pdev, plat_dat->bsp_priv);
|
||||
err_remove_config_dt:
|
||||
stmmac_remove_config_dt(pdev, plat_dat);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user