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

ACPI: fan: 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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Uwe Kleine-König and committed by
Rafael J. Wysocki
24fd13c0 c21f50e1

+2 -4
+2 -4
drivers/acpi/fan_core.c
··· 387 387 return result; 388 388 } 389 389 390 - static int acpi_fan_remove(struct platform_device *pdev) 390 + static void acpi_fan_remove(struct platform_device *pdev) 391 391 { 392 392 struct acpi_fan *fan = platform_get_drvdata(pdev); 393 393 ··· 399 399 sysfs_remove_link(&pdev->dev.kobj, "thermal_cooling"); 400 400 sysfs_remove_link(&fan->cdev->device.kobj, "device"); 401 401 thermal_cooling_device_unregister(fan->cdev); 402 - 403 - return 0; 404 402 } 405 403 406 404 #ifdef CONFIG_PM_SLEEP ··· 444 446 445 447 static struct platform_driver acpi_fan_driver = { 446 448 .probe = acpi_fan_probe, 447 - .remove = acpi_fan_remove, 449 + .remove_new = acpi_fan_remove, 448 450 .driver = { 449 451 .name = "acpi-fan", 450 452 .acpi_match_table = fan_device_ids,