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/x86: asus-wmi: 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>
Link: https://lore.kernel.org/r/639b9ffc18422fe59125893bd7909e8a73cffb72.1701726190.git.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
f2a2d85a 35ddd61c

+2 -3
+2 -3
drivers/platform/x86/asus-wmi.c
··· 4598 4598 return err; 4599 4599 } 4600 4600 4601 - static int asus_wmi_remove(struct platform_device *device) 4601 + static void asus_wmi_remove(struct platform_device *device) 4602 4602 { 4603 4603 struct asus_wmi *asus; 4604 4604 ··· 4619 4619 platform_profile_remove(); 4620 4620 4621 4621 kfree(asus); 4622 - return 0; 4623 4622 } 4624 4623 4625 4624 /* Platform driver - hibernate/resume callbacks *******************************/ ··· 4740 4741 return -EBUSY; 4741 4742 4742 4743 platform_driver = &driver->platform_driver; 4743 - platform_driver->remove = asus_wmi_remove; 4744 + platform_driver->remove_new = asus_wmi_remove; 4744 4745 platform_driver->driver.owner = driver->owner; 4745 4746 platform_driver->driver.name = driver->name; 4746 4747 platform_driver->driver.pm = &asus_pm_ops;