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

HID: surface-hid: kbd: 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>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>

authored by

Uwe Kleine-König and committed by
Jiri Kosina
009faf97 afbc301c

+2 -3
+2 -3
drivers/hid/surface-hid/surface_kbd.c
··· 271 271 return surface_hid_device_add(shid); 272 272 } 273 273 274 - static int surface_kbd_remove(struct platform_device *pdev) 274 + static void surface_kbd_remove(struct platform_device *pdev) 275 275 { 276 276 surface_hid_device_destroy(platform_get_drvdata(pdev)); 277 - return 0; 278 277 } 279 278 280 279 static const struct acpi_device_id surface_kbd_match[] = { ··· 284 285 285 286 static struct platform_driver surface_kbd_driver = { 286 287 .probe = surface_kbd_probe, 287 - .remove = surface_kbd_remove, 288 + .remove_new = surface_kbd_remove, 288 289 .driver = { 289 290 .name = "surface_keyboard", 290 291 .acpi_match_table = surface_kbd_match,