Commit d4295df3 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by David S. Miller

net: ethernet: broadcom: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c6e81783
...@@ -1344,17 +1344,15 @@ static int bcmasp_probe(struct platform_device *pdev) ...@@ -1344,17 +1344,15 @@ static int bcmasp_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int bcmasp_remove(struct platform_device *pdev) static void bcmasp_remove(struct platform_device *pdev)
{ {
struct bcmasp_priv *priv = dev_get_drvdata(&pdev->dev); struct bcmasp_priv *priv = dev_get_drvdata(&pdev->dev);
if (!priv) if (!priv)
return 0; return;
priv->destroy_wol(priv); priv->destroy_wol(priv);
bcmasp_remove_intfs(priv); bcmasp_remove_intfs(priv);
return 0;
} }
static void bcmasp_shutdown(struct platform_device *pdev) static void bcmasp_shutdown(struct platform_device *pdev)
...@@ -1428,7 +1426,7 @@ static SIMPLE_DEV_PM_OPS(bcmasp_pm_ops, ...@@ -1428,7 +1426,7 @@ static SIMPLE_DEV_PM_OPS(bcmasp_pm_ops,
static struct platform_driver bcmasp_driver = { static struct platform_driver bcmasp_driver = {
.probe = bcmasp_probe, .probe = bcmasp_probe,
.remove = bcmasp_remove, .remove_new = bcmasp_remove,
.shutdown = bcmasp_shutdown, .shutdown = bcmasp_shutdown,
.driver = { .driver = {
.name = "brcm,asp-v2", .name = "brcm,asp-v2",
......
...@@ -768,7 +768,7 @@ static int bcm4908_enet_probe(struct platform_device *pdev) ...@@ -768,7 +768,7 @@ static int bcm4908_enet_probe(struct platform_device *pdev)
return err; return err;
} }
static int bcm4908_enet_remove(struct platform_device *pdev) static void bcm4908_enet_remove(struct platform_device *pdev)
{ {
struct bcm4908_enet *enet = platform_get_drvdata(pdev); struct bcm4908_enet *enet = platform_get_drvdata(pdev);
...@@ -776,8 +776,6 @@ static int bcm4908_enet_remove(struct platform_device *pdev) ...@@ -776,8 +776,6 @@ static int bcm4908_enet_remove(struct platform_device *pdev)
netif_napi_del(&enet->rx_ring.napi); netif_napi_del(&enet->rx_ring.napi);
netif_napi_del(&enet->tx_ring.napi); netif_napi_del(&enet->tx_ring.napi);
bcm4908_enet_dma_free(enet); bcm4908_enet_dma_free(enet);
return 0;
} }
static const struct of_device_id bcm4908_enet_of_match[] = { static const struct of_device_id bcm4908_enet_of_match[] = {
...@@ -791,7 +789,7 @@ static struct platform_driver bcm4908_enet_driver = { ...@@ -791,7 +789,7 @@ static struct platform_driver bcm4908_enet_driver = {
.of_match_table = bcm4908_enet_of_match, .of_match_table = bcm4908_enet_of_match,
}, },
.probe = bcm4908_enet_probe, .probe = bcm4908_enet_probe,
.remove = bcm4908_enet_remove, .remove_new = bcm4908_enet_remove,
}; };
module_platform_driver(bcm4908_enet_driver); module_platform_driver(bcm4908_enet_driver);
......
...@@ -1902,7 +1902,7 @@ static int bcm_enet_probe(struct platform_device *pdev) ...@@ -1902,7 +1902,7 @@ static int bcm_enet_probe(struct platform_device *pdev)
/* /*
* exit func, stops hardware and unregisters netdevice * exit func, stops hardware and unregisters netdevice
*/ */
static int bcm_enet_remove(struct platform_device *pdev) static void bcm_enet_remove(struct platform_device *pdev)
{ {
struct bcm_enet_priv *priv; struct bcm_enet_priv *priv;
struct net_device *dev; struct net_device *dev;
...@@ -1932,12 +1932,11 @@ static int bcm_enet_remove(struct platform_device *pdev) ...@@ -1932,12 +1932,11 @@ static int bcm_enet_remove(struct platform_device *pdev)
clk_disable_unprepare(priv->mac_clk); clk_disable_unprepare(priv->mac_clk);
free_netdev(dev); free_netdev(dev);
return 0;
} }
static struct platform_driver bcm63xx_enet_driver = { static struct platform_driver bcm63xx_enet_driver = {
.probe = bcm_enet_probe, .probe = bcm_enet_probe,
.remove = bcm_enet_remove, .remove_new = bcm_enet_remove,
.driver = { .driver = {
.name = "bcm63xx_enet", .name = "bcm63xx_enet",
}, },
...@@ -2739,7 +2738,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev) ...@@ -2739,7 +2738,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
/* exit func, stops hardware and unregisters netdevice */ /* exit func, stops hardware and unregisters netdevice */
static int bcm_enetsw_remove(struct platform_device *pdev) static void bcm_enetsw_remove(struct platform_device *pdev)
{ {
struct bcm_enet_priv *priv; struct bcm_enet_priv *priv;
struct net_device *dev; struct net_device *dev;
...@@ -2752,12 +2751,11 @@ static int bcm_enetsw_remove(struct platform_device *pdev) ...@@ -2752,12 +2751,11 @@ static int bcm_enetsw_remove(struct platform_device *pdev)
clk_disable_unprepare(priv->mac_clk); clk_disable_unprepare(priv->mac_clk);
free_netdev(dev); free_netdev(dev);
return 0;
} }
static struct platform_driver bcm63xx_enetsw_driver = { static struct platform_driver bcm63xx_enetsw_driver = {
.probe = bcm_enetsw_probe, .probe = bcm_enetsw_probe,
.remove = bcm_enetsw_remove, .remove_new = bcm_enetsw_remove,
.driver = { .driver = {
.name = "bcm63xx_enetsw", .name = "bcm63xx_enetsw",
}, },
......
...@@ -2648,7 +2648,7 @@ static int bcm_sysport_probe(struct platform_device *pdev) ...@@ -2648,7 +2648,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int bcm_sysport_remove(struct platform_device *pdev) static void bcm_sysport_remove(struct platform_device *pdev)
{ {
struct net_device *dev = dev_get_drvdata(&pdev->dev); struct net_device *dev = dev_get_drvdata(&pdev->dev);
struct bcm_sysport_priv *priv = netdev_priv(dev); struct bcm_sysport_priv *priv = netdev_priv(dev);
...@@ -2663,8 +2663,6 @@ static int bcm_sysport_remove(struct platform_device *pdev) ...@@ -2663,8 +2663,6 @@ static int bcm_sysport_remove(struct platform_device *pdev)
of_phy_deregister_fixed_link(dn); of_phy_deregister_fixed_link(dn);
free_netdev(dev); free_netdev(dev);
dev_set_drvdata(&pdev->dev, NULL); dev_set_drvdata(&pdev->dev, NULL);
return 0;
} }
static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv) static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv)
...@@ -2901,7 +2899,7 @@ static SIMPLE_DEV_PM_OPS(bcm_sysport_pm_ops, ...@@ -2901,7 +2899,7 @@ static SIMPLE_DEV_PM_OPS(bcm_sysport_pm_ops,
static struct platform_driver bcm_sysport_driver = { static struct platform_driver bcm_sysport_driver = {
.probe = bcm_sysport_probe, .probe = bcm_sysport_probe,
.remove = bcm_sysport_remove, .remove_new = bcm_sysport_remove,
.driver = { .driver = {
.name = "brcm-systemport", .name = "brcm-systemport",
.of_match_table = bcm_sysport_of_match, .of_match_table = bcm_sysport_of_match,
......
...@@ -246,13 +246,11 @@ static int bgmac_probe(struct platform_device *pdev) ...@@ -246,13 +246,11 @@ static int bgmac_probe(struct platform_device *pdev)
return bgmac_enet_probe(bgmac); return bgmac_enet_probe(bgmac);
} }
static int bgmac_remove(struct platform_device *pdev) static void bgmac_remove(struct platform_device *pdev)
{ {
struct bgmac *bgmac = platform_get_drvdata(pdev); struct bgmac *bgmac = platform_get_drvdata(pdev);
bgmac_enet_remove(bgmac); bgmac_enet_remove(bgmac);
return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
...@@ -296,7 +294,7 @@ static struct platform_driver bgmac_enet_driver = { ...@@ -296,7 +294,7 @@ static struct platform_driver bgmac_enet_driver = {
.pm = BGMAC_PM_OPS .pm = BGMAC_PM_OPS
}, },
.probe = bgmac_probe, .probe = bgmac_probe,
.remove = bgmac_remove, .remove_new = bgmac_remove,
}; };
module_platform_driver(bgmac_enet_driver); module_platform_driver(bgmac_enet_driver);
......
...@@ -4164,7 +4164,7 @@ static int bcmgenet_probe(struct platform_device *pdev) ...@@ -4164,7 +4164,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
return err; return err;
} }
static int bcmgenet_remove(struct platform_device *pdev) static void bcmgenet_remove(struct platform_device *pdev)
{ {
struct bcmgenet_priv *priv = dev_to_priv(&pdev->dev); struct bcmgenet_priv *priv = dev_to_priv(&pdev->dev);
...@@ -4172,8 +4172,6 @@ static int bcmgenet_remove(struct platform_device *pdev) ...@@ -4172,8 +4172,6 @@ static int bcmgenet_remove(struct platform_device *pdev)
unregister_netdev(priv->dev); unregister_netdev(priv->dev);
bcmgenet_mii_exit(priv->dev); bcmgenet_mii_exit(priv->dev);
free_netdev(priv->dev); free_netdev(priv->dev);
return 0;
} }
static void bcmgenet_shutdown(struct platform_device *pdev) static void bcmgenet_shutdown(struct platform_device *pdev)
...@@ -4352,7 +4350,7 @@ MODULE_DEVICE_TABLE(acpi, genet_acpi_match); ...@@ -4352,7 +4350,7 @@ MODULE_DEVICE_TABLE(acpi, genet_acpi_match);
static struct platform_driver bcmgenet_driver = { static struct platform_driver bcmgenet_driver = {
.probe = bcmgenet_probe, .probe = bcmgenet_probe,
.remove = bcmgenet_remove, .remove_new = bcmgenet_remove,
.shutdown = bcmgenet_shutdown, .shutdown = bcmgenet_shutdown,
.driver = { .driver = {
.name = "bcmgenet", .name = "bcmgenet",
......
...@@ -2593,7 +2593,7 @@ static int sbmac_probe(struct platform_device *pldev) ...@@ -2593,7 +2593,7 @@ static int sbmac_probe(struct platform_device *pldev)
return err; return err;
} }
static int sbmac_remove(struct platform_device *pldev) static void sbmac_remove(struct platform_device *pldev)
{ {
struct net_device *dev = platform_get_drvdata(pldev); struct net_device *dev = platform_get_drvdata(pldev);
struct sbmac_softc *sc = netdev_priv(dev); struct sbmac_softc *sc = netdev_priv(dev);
...@@ -2604,13 +2604,11 @@ static int sbmac_remove(struct platform_device *pldev) ...@@ -2604,13 +2604,11 @@ static int sbmac_remove(struct platform_device *pldev)
mdiobus_free(sc->mii_bus); mdiobus_free(sc->mii_bus);
iounmap(sc->sbm_base); iounmap(sc->sbm_base);
free_netdev(dev); free_netdev(dev);
return 0;
} }
static struct platform_driver sbmac_driver = { static struct platform_driver sbmac_driver = {
.probe = sbmac_probe, .probe = sbmac_probe,
.remove = sbmac_remove, .remove_new = sbmac_remove,
.driver = { .driver = {
.name = sbmac_string, .name = sbmac_string,
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment