platform/x86: intel: chtwc_int33fe: Convert to platform remove callback returning...
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 2 Mar 2023 14:47:20 +0000 (15:47 +0100)
committerHans de Goede <hdegoede@redhat.com>
Tue, 7 Mar 2023 11:20:25 +0000 (12:20 +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 (mostly) ignored
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.

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/20230302144732.1903781-18-u.kleine-koenig@pengutronix.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/intel/chtwc_int33fe.c

index 2c9a7d52be0736d171b7791e9fac206ed9a8cb25..848baecc1bb02671f88052b7a8aa42a49a3080ad 100644 (file)
@@ -405,7 +405,7 @@ out_remove_nodes:
        return ret;
 }
 
-static int cht_int33fe_typec_remove(struct platform_device *pdev)
+static void cht_int33fe_typec_remove(struct platform_device *pdev)
 {
        struct cht_int33fe_data *data = platform_get_drvdata(pdev);
 
@@ -414,8 +414,6 @@ static int cht_int33fe_typec_remove(struct platform_device *pdev)
        i2c_unregister_device(data->battery_fg);
 
        cht_int33fe_remove_nodes(data);
-
-       return 0;
 }
 
 static const struct acpi_device_id cht_int33fe_acpi_ids[] = {
@@ -429,7 +427,7 @@ static struct platform_driver cht_int33fe_typec_driver = {
                .acpi_match_table = ACPI_PTR(cht_int33fe_acpi_ids),
        },
        .probe = cht_int33fe_typec_probe,
-       .remove = cht_int33fe_typec_remove,
+       .remove_new = cht_int33fe_typec_remove,
 };
 
 module_platform_driver(cht_int33fe_typec_driver);