Skip to content

Commit d3cd324

Browse files
Uwe Kleine-Königdavem330
authored andcommitted
net: ethernet: socionext: 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: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e8e2c86 commit d3cd324

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

drivers/net/ethernet/socionext/netsec.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,7 +2150,7 @@ static int netsec_probe(struct platform_device *pdev)
21502150
return ret;
21512151
}
21522152

2153-
static int netsec_remove(struct platform_device *pdev)
2153+
static void netsec_remove(struct platform_device *pdev)
21542154
{
21552155
struct netsec_priv *priv = platform_get_drvdata(pdev);
21562156

@@ -2162,8 +2162,6 @@ static int netsec_remove(struct platform_device *pdev)
21622162

21632163
pm_runtime_disable(&pdev->dev);
21642164
free_netdev(priv->ndev);
2165-
2166-
return 0;
21672165
}
21682166

21692167
#ifdef CONFIG_PM
@@ -2211,7 +2209,7 @@ MODULE_DEVICE_TABLE(acpi, netsec_acpi_ids);
22112209

22122210
static struct platform_driver netsec_driver = {
22132211
.probe = netsec_probe,
2214-
.remove = netsec_remove,
2212+
.remove_new = netsec_remove,
22152213
.driver = {
22162214
.name = "netsec",
22172215
.pm = &netsec_pm_ops,

drivers/net/ethernet/socionext/sni_ave.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,16 +1719,14 @@ static int ave_probe(struct platform_device *pdev)
17191719
return ret;
17201720
}
17211721

1722-
static int ave_remove(struct platform_device *pdev)
1722+
static void ave_remove(struct platform_device *pdev)
17231723
{
17241724
struct net_device *ndev = platform_get_drvdata(pdev);
17251725
struct ave_private *priv = netdev_priv(ndev);
17261726

17271727
unregister_netdev(ndev);
17281728
netif_napi_del(&priv->napi_rx);
17291729
netif_napi_del(&priv->napi_tx);
1730-
1731-
return 0;
17321730
}
17331731

17341732
#ifdef CONFIG_PM_SLEEP
@@ -1976,7 +1974,7 @@ MODULE_DEVICE_TABLE(of, of_ave_match);
19761974

19771975
static struct platform_driver ave_driver = {
19781976
.probe = ave_probe,
1979-
.remove = ave_remove,
1977+
.remove_new = ave_remove,
19801978
.driver = {
19811979
.name = "ave",
19821980
.pm = AVE_PM_OPS,

0 commit comments

Comments
 (0)