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

platform/x86: intel: mrfld_pwrbtn: 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-23-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
ee12d8b4 6ee08b4e

+2 -3
+2 -3
drivers/platform/x86/intel/mrfld_pwrbtn.c
··· 78 78 return 0; 79 79 } 80 80 81 - static int mrfld_pwrbtn_remove(struct platform_device *pdev) 81 + static void mrfld_pwrbtn_remove(struct platform_device *pdev) 82 82 { 83 83 struct device *dev = &pdev->dev; 84 84 85 85 dev_pm_clear_wake_irq(dev); 86 86 device_init_wakeup(dev, false); 87 - return 0; 88 87 } 89 88 90 89 static const struct platform_device_id mrfld_pwrbtn_id_table[] = { ··· 97 98 .name = "mrfld_bcove_pwrbtn", 98 99 }, 99 100 .probe = mrfld_pwrbtn_probe, 100 - .remove = mrfld_pwrbtn_remove, 101 + .remove_new = mrfld_pwrbtn_remove, 101 102 .id_table = mrfld_pwrbtn_id_table, 102 103 }; 103 104 module_platform_driver(mrfld_pwrbtn_driver);