powerpc: opal-prd: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 21 Feb 2024 15:40:17 +0000 (16:40 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 22 Feb 2024 10:55:32 +0000 (21:55 +1100)
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: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/28dd12b7cbde4b278b8b1d0ae4382dbd8ce9c9c5.1708529736.git.u.kleine-koenig@pengutronix.de
arch/powerpc/platforms/powernv/opal-prd.c

index b66b06efcef1e1001f27ad556ba3880678dee947..24f04f20d3e85c58a167fd6c639e72f09677f34a 100644 (file)
@@ -425,12 +425,11 @@ static int opal_prd_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int opal_prd_remove(struct platform_device *pdev)
+static void opal_prd_remove(struct platform_device *pdev)
 {
        misc_deregister(&opal_prd_dev);
        opal_message_notifier_unregister(OPAL_MSG_PRD, &opal_prd_event_nb);
        opal_message_notifier_unregister(OPAL_MSG_PRD2, &opal_prd_event_nb2);
-       return 0;
 }
 
 static const struct of_device_id opal_prd_match[] = {
@@ -444,7 +443,7 @@ static struct platform_driver opal_prd_driver = {
                .of_match_table = opal_prd_match,
        },
        .probe  = opal_prd_probe,
-       .remove = opal_prd_remove,
+       .remove_new = opal_prd_remove,
 };
 
 module_platform_driver(opal_prd_driver);