Skip to content

Commit 2ef9533

Browse files
Uwe Kleine-Königdlezcano
authored andcommitted
thermal/drivers/stm32: 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 (mostly) ignored 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. st_thermal_unregister() always returned zero, so convert it to return void without any loss and then just drop the return from st_mmap_remove(). Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a5639fa commit 2ef9533

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

drivers/thermal/st/st_thermal.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,12 @@ int st_thermal_register(struct platform_device *pdev,
227227
}
228228
EXPORT_SYMBOL_GPL(st_thermal_register);
229229

230-
int st_thermal_unregister(struct platform_device *pdev)
230+
void st_thermal_unregister(struct platform_device *pdev)
231231
{
232232
struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
233233

234234
st_thermal_sensor_off(sensor);
235235
thermal_zone_device_unregister(sensor->thermal_dev);
236-
237-
return 0;
238236
}
239237
EXPORT_SYMBOL_GPL(st_thermal_unregister);
240238

drivers/thermal/st/st_thermal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct st_thermal_sensor {
9494

9595
extern int st_thermal_register(struct platform_device *pdev,
9696
const struct of_device_id *st_thermal_of_match);
97-
extern int st_thermal_unregister(struct platform_device *pdev);
97+
extern void st_thermal_unregister(struct platform_device *pdev);
9898
extern const struct dev_pm_ops st_thermal_pm_ops;
9999

100100
#endif /* __STI_RESET_SYSCFG_H */

drivers/thermal/st/st_thermal_memmap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ static int st_mmap_probe(struct platform_device *pdev)
172172
return st_thermal_register(pdev, st_mmap_thermal_of_match);
173173
}
174174

175-
static int st_mmap_remove(struct platform_device *pdev)
175+
static void st_mmap_remove(struct platform_device *pdev)
176176
{
177-
return st_thermal_unregister(pdev);
177+
st_thermal_unregister(pdev);
178178
}
179179

180180
static struct platform_driver st_mmap_thermal_driver = {
@@ -184,7 +184,7 @@ static struct platform_driver st_mmap_thermal_driver = {
184184
.of_match_table = st_mmap_thermal_of_match,
185185
},
186186
.probe = st_mmap_probe,
187-
.remove = st_mmap_remove,
187+
.remove_new = st_mmap_remove,
188188
};
189189

190190
module_platform_driver(st_mmap_thermal_driver);

0 commit comments

Comments
 (0)