net: ethernet: socionext: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 18 Sep 2023 20:42:18 +0000 (22:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Sep 2023 08:06:40 +0000 (09:06 +0100)
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>
drivers/net/ethernet/socionext/netsec.c
drivers/net/ethernet/socionext/sni_ave.c

index f358ea003193698cb48ed0362be9e9f96e90d6db..d9cfafb9608566d09d6a8002c38037a3242cc848 100644 (file)
@@ -2150,7 +2150,7 @@ free_ndev:
        return ret;
 }
 
-static int netsec_remove(struct platform_device *pdev)
+static void netsec_remove(struct platform_device *pdev)
 {
        struct netsec_priv *priv = platform_get_drvdata(pdev);
 
@@ -2162,8 +2162,6 @@ static int netsec_remove(struct platform_device *pdev)
 
        pm_runtime_disable(&pdev->dev);
        free_netdev(priv->ndev);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM
@@ -2211,7 +2209,7 @@ MODULE_DEVICE_TABLE(acpi, netsec_acpi_ids);
 
 static struct platform_driver netsec_driver = {
        .probe  = netsec_probe,
-       .remove = netsec_remove,
+       .remove_new = netsec_remove,
        .driver = {
                .name = "netsec",
                .pm = &netsec_pm_ops,
index 4838d2383a43ca48c8283d2ce7ea348ac61ddb82..eed24e67c5a674b8e51c54013acd569a9645696e 100644 (file)
@@ -1719,7 +1719,7 @@ out_del_napi:
        return ret;
 }
 
-static int ave_remove(struct platform_device *pdev)
+static void ave_remove(struct platform_device *pdev)
 {
        struct net_device *ndev = platform_get_drvdata(pdev);
        struct ave_private *priv = netdev_priv(ndev);
@@ -1727,8 +1727,6 @@ static int ave_remove(struct platform_device *pdev)
        unregister_netdev(ndev);
        netif_napi_del(&priv->napi_rx);
        netif_napi_del(&priv->napi_tx);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -1976,7 +1974,7 @@ MODULE_DEVICE_TABLE(of, of_ave_match);
 
 static struct platform_driver ave_driver = {
        .probe  = ave_probe,
-       .remove = ave_remove,
+       .remove_new = ave_remove,
        .driver = {
                .name = "ave",
                .pm   = AVE_PM_OPS,