EDAC/zynqmp: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 4 Oct 2023 13:12:54 +0000 (15:12 +0200)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 20 Nov 2023 22:33:21 +0000 (23:33 +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>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20231004131254.2673842-22-u.kleine-koenig@pengutronix.de
drivers/edac/zynqmp_edac.c

index ac7d1e0b324c76221facf391e01bd22830dccdb9..2d9a5cfd89317a6feb80137b2f5917fba9c2d2e0 100644 (file)
@@ -426,7 +426,7 @@ free_dev_ctl:
        return ret;
 }
 
-static int edac_remove(struct platform_device *pdev)
+static void edac_remove(struct platform_device *pdev)
 {
        struct edac_device_ctl_info *dci = platform_get_drvdata(pdev);
        struct edac_priv *priv = dci->pvt_info;
@@ -440,8 +440,6 @@ static int edac_remove(struct platform_device *pdev)
 
        edac_device_del_device(&pdev->dev);
        edac_device_free_ctl_info(dci);
-
-       return 0;
 }
 
 static const struct of_device_id zynqmp_ocm_edac_match[] = {
@@ -457,7 +455,7 @@ static struct platform_driver zynqmp_ocm_edac_driver = {
                   .of_match_table = zynqmp_ocm_edac_match,
                   },
        .probe = edac_probe,
-       .remove = edac_remove,
+       .remove_new = edac_remove,
 };
 
 module_platform_driver(zynqmp_ocm_edac_driver);