perf: arm_dmc620: Convert to platform remove callback returning void

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/20cc24ede88f5e000991dfe6f4cf1222b819e337.1702648125.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
Uwe Kleine-König 2023-12-15 14:59:07 +01:00 committed by Will Deacon
parent 79dc1570b3
commit ca1e01c8d3

View File

@ -724,7 +724,7 @@ out_teardown_dev:
return ret; return ret;
} }
static int dmc620_pmu_device_remove(struct platform_device *pdev) static void dmc620_pmu_device_remove(struct platform_device *pdev)
{ {
struct dmc620_pmu *dmc620_pmu = platform_get_drvdata(pdev); struct dmc620_pmu *dmc620_pmu = platform_get_drvdata(pdev);
@ -732,8 +732,6 @@ static int dmc620_pmu_device_remove(struct platform_device *pdev)
/* perf will synchronise RCU before devres can free dmc620_pmu */ /* perf will synchronise RCU before devres can free dmc620_pmu */
perf_pmu_unregister(&dmc620_pmu->pmu); perf_pmu_unregister(&dmc620_pmu->pmu);
return 0;
} }
static const struct acpi_device_id dmc620_acpi_match[] = { static const struct acpi_device_id dmc620_acpi_match[] = {
@ -748,7 +746,7 @@ static struct platform_driver dmc620_pmu_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
.probe = dmc620_pmu_device_probe, .probe = dmc620_pmu_device_probe,
.remove = dmc620_pmu_device_remove, .remove_new = dmc620_pmu_device_remove,
}; };
static int __init dmc620_pmu_init(void) static int __init dmc620_pmu_init(void)