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: hp-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/a6b074b7ee37f3682da4b3f39ea40af97add64c2.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
3df69216 f2a2d85a

+2 -4
+2 -4
drivers/platform/x86/hp/hp-wmi.c
··· 1478 1478 return 0; 1479 1479 } 1480 1480 1481 - static int __exit hp_wmi_bios_remove(struct platform_device *device) 1481 + static void __exit hp_wmi_bios_remove(struct platform_device *device) 1482 1482 { 1483 1483 int i; 1484 1484 ··· 1502 1502 1503 1503 if (platform_profile_support) 1504 1504 platform_profile_remove(); 1505 - 1506 - return 0; 1507 1505 } 1508 1506 1509 1507 static int hp_wmi_resume_handler(struct device *device) ··· 1558 1560 .pm = &hp_wmi_pm_ops, 1559 1561 .dev_groups = hp_wmi_groups, 1560 1562 }, 1561 - .remove = __exit_p(hp_wmi_bios_remove), 1563 + .remove_new = __exit_p(hp_wmi_bios_remove), 1562 1564 }; 1563 1565 1564 1566 static umode_t hp_wmi_hwmon_is_visible(const void *data,