Skip to content

Commit 295b117

Browse files
Uwe Kleine-Königrafaeljw
authored andcommitted
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 <[email protected]> Acked-by: Daniel Lezcano <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 7c2714a commit 295b117

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/thermal/sprd_thermal.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ static int sprd_thm_resume(struct device *dev)
516516
}
517517
#endif
518518

519-
static int sprd_thm_remove(struct platform_device *pdev)
519+
static void sprd_thm_remove(struct platform_device *pdev)
520520
{
521521
struct sprd_thermal_data *thm = platform_get_drvdata(pdev);
522522
int i;
@@ -528,7 +528,6 @@ static int sprd_thm_remove(struct platform_device *pdev)
528528
}
529529

530530
clk_disable_unprepare(thm->clk);
531-
return 0;
532531
}
533532

534533
static const struct of_device_id sprd_thermal_of_match[] = {
@@ -543,7 +542,7 @@ static const struct dev_pm_ops sprd_thermal_pm_ops = {
543542

544543
static struct platform_driver sprd_thermal_driver = {
545544
.probe = sprd_thm_probe,
546-
.remove = sprd_thm_remove,
545+
.remove_new = sprd_thm_remove,
547546
.driver = {
548547
.name = "sprd-thermal",
549548
.pm = &sprd_thermal_pm_ops,

0 commit comments

Comments
 (0)