Skip to content

Commit 0c84561

Browse files
Uwe Kleine-Königjwrdegoede
authored andcommitted
platform/surface: dtx: 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() is 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> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20230917203805.1149595-6-u.kleine-koenig@pengutronix.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 09416e0 commit 0c84561

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/platform/surface/surface_dtx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,10 +1168,9 @@ static int surface_dtx_platform_probe(struct platform_device *pdev)
11681168
return 0;
11691169
}
11701170

1171-
static int surface_dtx_platform_remove(struct platform_device *pdev)
1171+
static void surface_dtx_platform_remove(struct platform_device *pdev)
11721172
{
11731173
sdtx_device_destroy(platform_get_drvdata(pdev));
1174-
return 0;
11751174
}
11761175

11771176
static const struct acpi_device_id surface_dtx_acpi_match[] = {
@@ -1182,7 +1181,7 @@ MODULE_DEVICE_TABLE(acpi, surface_dtx_acpi_match);
11821181

11831182
static struct platform_driver surface_dtx_platform_driver = {
11841183
.probe = surface_dtx_platform_probe,
1185-
.remove = surface_dtx_platform_remove,
1184+
.remove_new = surface_dtx_platform_remove,
11861185
.driver = {
11871186
.name = "surface_dtx_pltf",
11881187
.acpi_match_table = surface_dtx_acpi_match,

0 commit comments

Comments
 (0)