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: acpi-notify: 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-3-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
342d7dce 8d53109d

+2 -4
+2 -4
drivers/platform/surface/surface_acpi_notify.c
··· 850 850 return status; 851 851 } 852 852 853 - static int san_remove(struct platform_device *pdev) 853 + static void san_remove(struct platform_device *pdev) 854 854 { 855 855 acpi_handle san = ACPI_HANDLE(&pdev->dev); 856 856 ··· 864 864 * all delayed works they may have spawned are run to completion. 865 865 */ 866 866 flush_workqueue(san_wq); 867 - 868 - return 0; 869 867 } 870 868 871 869 static const struct acpi_device_id san_match[] = { ··· 874 876 875 877 static struct platform_driver surface_acpi_notify = { 876 878 .probe = san_probe, 877 - .remove = san_remove, 879 + .remove_new = san_remove, 878 880 .driver = { 879 881 .name = "surface_acpi_notify", 880 882 .acpi_match_table = san_match,