Skip to content

Commit f113c11

Browse files
Uwe Kleine-Königthierryreding
authored andcommitted
pwm: spear: 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. 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: Thierry Reding <thierry.reding@gmail.com>
1 parent 533d294 commit f113c11

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/pwm/pwm-spear.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,14 @@ static int spear_pwm_probe(struct platform_device *pdev)
247247
return ret;
248248
}
249249

250-
static int spear_pwm_remove(struct platform_device *pdev)
250+
static void spear_pwm_remove(struct platform_device *pdev)
251251
{
252252
struct spear_pwm_chip *pc = platform_get_drvdata(pdev);
253253

254254
pwmchip_remove(&pc->chip);
255255

256256
/* clk was prepared in probe, hence unprepare it here */
257257
clk_unprepare(pc->clk);
258-
259-
return 0;
260258
}
261259

262260
static const struct of_device_id spear_pwm_of_match[] = {
@@ -273,7 +271,7 @@ static struct platform_driver spear_pwm_driver = {
273271
.of_match_table = spear_pwm_of_match,
274272
},
275273
.probe = spear_pwm_probe,
276-
.remove = spear_pwm_remove,
274+
.remove_new = spear_pwm_remove,
277275
};
278276

279277
module_platform_driver(spear_pwm_driver);

0 commit comments

Comments
 (0)