Skip to content

Commit ca92bde

Browse files
Uwe Kleine-Königrafaeljw
authored andcommitted
thermal: stm: 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 295b117 commit ca92bde

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/thermal/st/stm_thermal.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,12 @@ static int stm_thermal_probe(struct platform_device *pdev)
569569
return ret;
570570
}
571571

572-
static int stm_thermal_remove(struct platform_device *pdev)
572+
static void stm_thermal_remove(struct platform_device *pdev)
573573
{
574574
struct stm_thermal_sensor *sensor = platform_get_drvdata(pdev);
575575

576576
stm_thermal_sensor_off(sensor);
577577
thermal_remove_hwmon_sysfs(sensor->th_dev);
578-
579-
return 0;
580578
}
581579

582580
static struct platform_driver stm_thermal_driver = {
@@ -586,7 +584,7 @@ static struct platform_driver stm_thermal_driver = {
586584
.of_match_table = stm_thermal_of_match,
587585
},
588586
.probe = stm_thermal_probe,
589-
.remove = stm_thermal_remove,
587+
.remove_new = stm_thermal_remove,
590588
};
591589
module_platform_driver(stm_thermal_driver);
592590

0 commit comments

Comments
 (0)