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

thermal: sprd: 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>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Uwe Kleine-König and committed by
Rafael J. Wysocki
295b1176 7c2714a1

+2 -3
+2 -3
drivers/thermal/sprd_thermal.c
··· 516 516 } 517 517 #endif 518 518 519 - static int sprd_thm_remove(struct platform_device *pdev) 519 + static void sprd_thm_remove(struct platform_device *pdev) 520 520 { 521 521 struct sprd_thermal_data *thm = platform_get_drvdata(pdev); 522 522 int i; ··· 528 528 } 529 529 530 530 clk_disable_unprepare(thm->clk); 531 - return 0; 532 531 } 533 532 534 533 static const struct of_device_id sprd_thermal_of_match[] = { ··· 542 543 543 544 static struct platform_driver sprd_thermal_driver = { 544 545 .probe = sprd_thm_probe, 545 - .remove = sprd_thm_remove, 546 + .remove_new = sprd_thm_remove, 546 547 .driver = { 547 548 .name = "sprd-thermal", 548 549 .pm = &sprd_thermal_pm_ops,