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: hotplug: 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-8-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
d5e2c233 52f8a4b6

+2 -4
+2 -4
drivers/platform/surface/surface_hotplug.c
··· 183 183 return 0; 184 184 } 185 185 186 - static int surface_hotplug_remove(struct platform_device *pdev) 186 + static void surface_hotplug_remove(struct platform_device *pdev) 187 187 { 188 188 struct shps_device *sdev = platform_get_drvdata(pdev); 189 189 int i; ··· 195 195 196 196 mutex_destroy(&sdev->lock[i]); 197 197 } 198 - 199 - return 0; 200 198 } 201 199 202 200 static int surface_hotplug_probe(struct platform_device *pdev) ··· 259 261 260 262 static struct platform_driver surface_hotplug_driver = { 261 263 .probe = surface_hotplug_probe, 262 - .remove = surface_hotplug_remove, 264 + .remove_new = surface_hotplug_remove, 263 265 .driver = { 264 266 .name = "surface_hotplug", 265 267 .acpi_match_table = surface_hotplug_acpi_match,