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: gpe: 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-7-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
52f8a4b6 0c845611

+2 -4
+2 -4
drivers/platform/surface/surface_gpe.c
··· 267 267 return ret; 268 268 } 269 269 270 - static int surface_gpe_remove(struct platform_device *pdev) 270 + static void surface_gpe_remove(struct platform_device *pdev) 271 271 { 272 272 struct surface_lid_device *lid = dev_get_drvdata(&pdev->dev); 273 273 274 274 /* restore default behavior without this module */ 275 275 surface_lid_enable_wakeup(&pdev->dev, false); 276 276 acpi_disable_gpe(NULL, lid->gpe_number); 277 - 278 - return 0; 279 277 } 280 278 281 279 static struct platform_driver surface_gpe_driver = { 282 280 .probe = surface_gpe_probe, 283 - .remove = surface_gpe_remove, 281 + .remove_new = surface_gpe_remove, 284 282 .driver = { 285 283 .name = "surface_gpe", 286 284 .pm = &surface_gpe_pm,