intel_th: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 29 Apr 2024 13:01:09 +0000 (16:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 May 2024 16:57:22 +0000 (18:57 +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>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240429130119.1518073-6-alexander.shishkin@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/intel_th/acpi.c

index 87f9024e4bbb7c945fb62b81540fd9b5b2cca209..503620e9fd1054a40e772dd834c625a8b3a4b7be 100644 (file)
@@ -60,18 +60,16 @@ static int intel_th_acpi_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int intel_th_acpi_remove(struct platform_device *pdev)
+static void intel_th_acpi_remove(struct platform_device *pdev)
 {
        struct intel_th *th = platform_get_drvdata(pdev);
 
        intel_th_free(th);
-
-       return 0;
 }
 
 static struct platform_driver intel_th_acpi_driver = {
        .probe          = intel_th_acpi_probe,
-       .remove         = intel_th_acpi_remove,
+       .remove_new     = intel_th_acpi_remove,
        .driver         = {
                .name                   = DRIVER_NAME,
                .acpi_match_table       = intel_th_acpi_ids,