EDAC/npcm: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 4 Oct 2023 13:12:44 +0000 (15:12 +0200)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 20 Nov 2023 21:52:14 +0000 (22:52 +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>
Link: https://lore.kernel.org/r/20231004131254.2673842-12-u.kleine-koenig@pengutronix.de
drivers/edac/npcm_edac.c

index 6d15c1550263fa6f891b35e2bfd3ce01ae27569a..2e2133b784e92251dc26f4a3661c5d50505ba039 100644 (file)
@@ -410,7 +410,7 @@ free_edac_mc:
        return rc;
 }
 
-static int edac_remove(struct platform_device *pdev)
+static void edac_remove(struct platform_device *pdev)
 {
        struct mem_ctl_info *mci = platform_get_drvdata(pdev);
        struct priv_data *priv = mci->pvt_info;
@@ -426,8 +426,6 @@ static int edac_remove(struct platform_device *pdev)
        regmap_write(npcm_regmap, pdata->ctl_int_mask_master,
                     pdata->int_mask_master_global_mask);
        regmap_update_bits(npcm_regmap, pdata->ctl_ecc_en, pdata->ecc_en_mask, 0);
-
-       return 0;
 }
 
 static const struct npcm_platform_data npcm750_edac = {
@@ -533,7 +531,7 @@ static struct platform_driver npcm_edac_driver = {
                .of_match_table = npcm_edac_of_match,
        },
        .probe = edac_probe,
-       .remove = edac_remove,
+       .remove_new = edac_remove,
 };
 
 module_platform_driver(npcm_edac_driver);