EDAC/fsl_ddr: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 13 Oct 2023 10:04:23 +0000 (12:04 +0200)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 20 Nov 2023 22:34:04 +0000 (23:34 +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().

fsl_mc_err_remove() is used as callback in two drivers. So these have to
be converted together to the void returning remove callback.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20231013100422.1382040-2-u.kleine-koenig@pengutronix.de
drivers/edac/fsl_ddr_edac.c
drivers/edac/fsl_ddr_edac.h
drivers/edac/layerscape_edac.c
drivers/edac/mpc85xx_edac.c

index b81757555a8a967a4ce47edd5d5bdbc901a070a2..d148d262d0d4de2e26f1adde9781193755b58c65 100644 (file)
@@ -612,7 +612,7 @@ err:
        return res;
 }
 
-int fsl_mc_err_remove(struct platform_device *op)
+void fsl_mc_err_remove(struct platform_device *op)
 {
        struct mem_ctl_info *mci = dev_get_drvdata(&op->dev);
        struct fsl_mc_pdata *pdata = mci->pvt_info;
@@ -629,5 +629,4 @@ int fsl_mc_err_remove(struct platform_device *op)
 
        edac_mc_del_mc(&op->dev);
        edac_mc_free(mci);
-       return 0;
 }
index 332439d7b2d97f423c2bae053e0011b2b453f342..c0994a2a003c28a6c175dea3925c19319cc05ed7 100644 (file)
@@ -72,5 +72,5 @@ struct fsl_mc_pdata {
        int irq;
 };
 int fsl_mc_err_probe(struct platform_device *op);
-int fsl_mc_err_remove(struct platform_device *op);
+void fsl_mc_err_remove(struct platform_device *op);
 #endif
index 7c5e2b3c0daa0c7e09ae58aee84679ea8b30f9cf..d2f895033280f49939f818eeed1384672fb5fb53 100644 (file)
@@ -27,7 +27,7 @@ MODULE_DEVICE_TABLE(of, fsl_ddr_mc_err_of_match);
 
 static struct platform_driver fsl_ddr_mc_err_driver = {
        .probe = fsl_mc_err_probe,
-       .remove = fsl_mc_err_remove,
+       .remove_new = fsl_mc_err_remove,
        .driver = {
                .name = "fsl_ddr_mc_err",
                .of_match_table = fsl_ddr_mc_err_of_match,
index e0d702cef66f7a46a2030ca96158f9ddd0f3634a..c1bc53f4e184c80bf2ab8ab0aa66d228e6ad9766 100644 (file)
@@ -656,7 +656,7 @@ MODULE_DEVICE_TABLE(of, mpc85xx_mc_err_of_match);
 
 static struct platform_driver mpc85xx_mc_err_driver = {
        .probe = fsl_mc_err_probe,
-       .remove = fsl_mc_err_remove,
+       .remove_new = fsl_mc_err_remove,
        .driver = {
                .name = "mpc85xx_mc_err",
                .of_match_table = mpc85xx_mc_err_of_match,