powerpc/powernv: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 10 Apr 2024 12:47:07 +0000 (14:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Apr 2024 13:26:59 +0000 (15:26 +0200)
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>
Link: https://lore.kernel.org/r/20240410124707.194228-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/powernv-op-panel.c

index 3c99696b145ee62a82a53ed0c7d393f66234e3f0..f2cff1a6fed520d1dce659e8ab348524f0dba8ee 100644 (file)
@@ -195,12 +195,11 @@ free_oppanel_data:
        return rc;
 }
 
-static int oppanel_remove(struct platform_device *pdev)
+static void oppanel_remove(struct platform_device *pdev)
 {
        misc_deregister(&oppanel_dev);
        kfree(oppanel_lines);
        kfree(oppanel_data);
-       return 0;
 }
 
 static const struct of_device_id oppanel_match[] = {
@@ -214,7 +213,7 @@ static struct platform_driver oppanel_driver = {
                .of_match_table = oppanel_match,
        },
        .probe  = oppanel_probe,
-       .remove = oppanel_remove,
+       .remove_new = oppanel_remove,
 };
 
 module_platform_driver(oppanel_driver);