net: ethernet: 8390: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 18 Sep 2023 20:41:33 +0000 (22:41 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Sep 2023 08:06:37 +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/8390/ax88796.c
drivers/net/ethernet/8390/mcf8390.c
drivers/net/ethernet/8390/ne.c

index af60325..2874680 100644 (file)
@@ -811,7 +811,7 @@ static int ax_init_dev(struct net_device *dev)
        return ret;
 }
 
-static int ax_remove(struct platform_device *pdev)
+static void ax_remove(struct platform_device *pdev)
 {
        struct net_device *dev = platform_get_drvdata(pdev);
        struct ei_device *ei_local = netdev_priv(dev);
@@ -832,8 +832,6 @@ static int ax_remove(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, NULL);
        free_netdev(dev);
-
-       return 0;
 }
 
 /*
@@ -1011,7 +1009,7 @@ static struct platform_driver axdrv = {
                .name           = "ax88796",
        },
        .probe          = ax_probe,
-       .remove         = ax_remove,
+       .remove_new     = ax_remove,
        .suspend        = ax_suspend,
        .resume         = ax_resume,
 };
index 217838b..5a0fa99 100644 (file)
@@ -441,7 +441,7 @@ static int mcf8390_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int mcf8390_remove(struct platform_device *pdev)
+static void mcf8390_remove(struct platform_device *pdev)
 {
        struct net_device *dev = platform_get_drvdata(pdev);
        struct resource *mem;
@@ -450,7 +450,6 @@ static int mcf8390_remove(struct platform_device *pdev)
        mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        release_mem_region(mem->start, resource_size(mem));
        free_netdev(dev);
-       return 0;
 }
 
 static struct platform_driver mcf8390_drv = {
@@ -458,7 +457,7 @@ static struct platform_driver mcf8390_drv = {
                .name   = "mcf8390",
        },
        .probe          = mcf8390_probe,
-       .remove         = mcf8390_remove,
+       .remove_new     = mcf8390_remove,
 };
 
 module_platform_driver(mcf8390_drv);
index 7d89ec1..350683a 100644 (file)
@@ -823,7 +823,7 @@ static int __init ne_drv_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int ne_drv_remove(struct platform_device *pdev)
+static void ne_drv_remove(struct platform_device *pdev)
 {
        struct net_device *dev = platform_get_drvdata(pdev);
 
@@ -842,7 +842,6 @@ static int ne_drv_remove(struct platform_device *pdev)
                release_region(dev->base_addr, NE_IO_EXTENT);
                free_netdev(dev);
        }
-       return 0;
 }
 
 /* Remove unused devices or all if true. */
@@ -895,7 +894,7 @@ static int ne_drv_resume(struct platform_device *pdev)
 #endif
 
 static struct platform_driver ne_driver = {
-       .remove         = ne_drv_remove,
+       .remove_new     = ne_drv_remove,
        .suspend        = ne_drv_suspend,
        .resume         = ne_drv_resume,
        .driver         = {