net: ethernet: mellanox: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 18 Sep 2023 20:42:03 +0000 (22:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Sep 2023 08:06:39 +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 this driver 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>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c

index 694de95..954ba08 100644 (file)
@@ -471,7 +471,7 @@ out:
        return err;
 }
 
-static int mlxbf_gige_remove(struct platform_device *pdev)
+static void mlxbf_gige_remove(struct platform_device *pdev)
 {
        struct mlxbf_gige *priv = platform_get_drvdata(pdev);
 
@@ -479,8 +479,6 @@ static int mlxbf_gige_remove(struct platform_device *pdev)
        phy_disconnect(priv->netdev->phydev);
        mlxbf_gige_mdio_remove(priv);
        platform_set_drvdata(pdev, NULL);
-
-       return 0;
 }
 
 static void mlxbf_gige_shutdown(struct platform_device *pdev)
@@ -499,7 +497,7 @@ MODULE_DEVICE_TABLE(acpi, mlxbf_gige_acpi_match);
 
 static struct platform_driver mlxbf_gige_driver = {
        .probe = mlxbf_gige_probe,
-       .remove = mlxbf_gige_remove,
+       .remove_new = mlxbf_gige_remove,
        .shutdown = mlxbf_gige_shutdown,
        .driver = {
                .name = KBUILD_MODNAME,