Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Uwe Kleine-König and committed by
Hans de Goede
0c845611 09416e0f

+2 -3
+2 -3
drivers/platform/surface/surface_dtx.c
··· 1168 1168 return 0; 1169 1169 } 1170 1170 1171 - static int surface_dtx_platform_remove(struct platform_device *pdev) 1171 + static void surface_dtx_platform_remove(struct platform_device *pdev) 1172 1172 { 1173 1173 sdtx_device_destroy(platform_get_drvdata(pdev)); 1174 - return 0; 1175 1174 } 1176 1175 1177 1176 static const struct acpi_device_id surface_dtx_acpi_match[] = { ··· 1181 1182 1182 1183 static struct platform_driver surface_dtx_platform_driver = { 1183 1184 .probe = surface_dtx_platform_probe, 1184 - .remove = surface_dtx_platform_remove, 1185 + .remove_new = surface_dtx_platform_remove, 1185 1186 .driver = { 1186 1187 .name = "surface_dtx_pltf", 1187 1188 .acpi_match_table = surface_dtx_acpi_match,