1

mfd: kempld-core: 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/20231123165627.492259-8-u.kleine-koenig@pengutronix.de
Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
Uwe Kleine-König 2023-11-23 17:56:35 +01:00 committed by Lee Jones
parent dd28e01d39
commit 0c45dd8614

View File

@ -535,7 +535,7 @@ static int kempld_probe(struct platform_device *pdev)
return kempld_detect_device(pld); return kempld_detect_device(pld);
} }
static int kempld_remove(struct platform_device *pdev) static void kempld_remove(struct platform_device *pdev)
{ {
struct kempld_device_data *pld = platform_get_drvdata(pdev); struct kempld_device_data *pld = platform_get_drvdata(pdev);
const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
@ -544,8 +544,6 @@ static int kempld_remove(struct platform_device *pdev)
mfd_remove_devices(&pdev->dev); mfd_remove_devices(&pdev->dev);
pdata->release_hardware_mutex(pld); pdata->release_hardware_mutex(pld);
return 0;
} }
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
@ -563,7 +561,7 @@ static struct platform_driver kempld_driver = {
.acpi_match_table = ACPI_PTR(kempld_acpi_table), .acpi_match_table = ACPI_PTR(kempld_acpi_table),
}, },
.probe = kempld_probe, .probe = kempld_probe,
.remove = kempld_remove, .remove_new = kempld_remove,
}; };
static const struct dmi_system_id kempld_dmi_table[] __initconst = { static const struct dmi_system_id kempld_dmi_table[] __initconst = {