]> git.itanic.dy.fi Git - linux-stable/commitdiff
firmware: stratix10-svc: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 27 Dec 2023 16:26:33 +0000 (17:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Jan 2024 16:01:15 +0000 (17:01 +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() will be 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>
Acked-by: Dinh Nguyen <dinguyen@kernel.org>
Link: https://lore.kernel.org/r/e574041cdce2e4e69f729dfa726a6d090762cff9.1703693980.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/stratix10-svc.c

index c693da60e9a97770f83dc7d91febcec687d18650..528f37417aea48532003125cb8eacebff312e160 100644 (file)
@@ -1251,7 +1251,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int stratix10_svc_drv_remove(struct platform_device *pdev)
+static void stratix10_svc_drv_remove(struct platform_device *pdev)
 {
        struct stratix10_svc *svc = dev_get_drvdata(&pdev->dev);
        struct stratix10_svc_controller *ctrl = platform_get_drvdata(pdev);
@@ -1267,13 +1267,11 @@ static int stratix10_svc_drv_remove(struct platform_device *pdev)
        if (ctrl->genpool)
                gen_pool_destroy(ctrl->genpool);
        list_del(&ctrl->node);
-
-       return 0;
 }
 
 static struct platform_driver stratix10_svc_driver = {
        .probe = stratix10_svc_drv_probe,
-       .remove = stratix10_svc_drv_remove,
+       .remove_new = stratix10_svc_drv_remove,
        .driver = {
                .name = "stratix10-svc",
                .of_match_table = stratix10_svc_drv_match,