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

platform/x86: intel: hid: 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 (mostly) ignored
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.

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>
Link: https://lore.kernel.org/r/20230302144732.1903781-19-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
63b89016 fba53497

+2 -8
+2 -8
drivers/platform/x86/intel/hid.c
··· 720 720 return err; 721 721 } 722 722 723 - static int intel_hid_remove(struct platform_device *device) 723 + static void intel_hid_remove(struct platform_device *device) 724 724 { 725 725 acpi_handle handle = ACPI_HANDLE(&device->dev); 726 726 ··· 728 728 acpi_remove_notify_handler(handle, ACPI_DEVICE_NOTIFY, notify_handler); 729 729 intel_hid_set_enable(&device->dev, false); 730 730 intel_button_array_enable(&device->dev, false); 731 - 732 - /* 733 - * Even if we failed to shut off the event stream, we can still 734 - * safely detach from the device. 735 - */ 736 - return 0; 737 731 } 738 732 739 733 static struct platform_driver intel_hid_pl_driver = { ··· 737 743 .pm = &intel_hid_pl_pm_ops, 738 744 }, 739 745 .probe = intel_hid_probe, 740 - .remove = intel_hid_remove, 746 + .remove_new = intel_hid_remove, 741 747 }; 742 748 743 749 /*