Skip to content

Commit 533d294

Browse files
Uwe Kleine-Königthierryreding
authored andcommitted
pwm: sifive: 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 1d4f997 commit 533d294

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/pwm/pwm-sifive.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static int pwm_sifive_probe(struct platform_device *pdev)
313313
return ret;
314314
}
315315

316-
static int pwm_sifive_remove(struct platform_device *dev)
316+
static void pwm_sifive_remove(struct platform_device *dev)
317317
{
318318
struct pwm_sifive_ddata *ddata = platform_get_drvdata(dev);
319319
struct pwm_device *pwm;
@@ -329,8 +329,6 @@ static int pwm_sifive_remove(struct platform_device *dev)
329329
}
330330

331331
clk_unprepare(ddata->clk);
332-
333-
return 0;
334332
}
335333

336334
static const struct of_device_id pwm_sifive_of_match[] = {
@@ -341,7 +339,7 @@ MODULE_DEVICE_TABLE(of, pwm_sifive_of_match);
341339

342340
static struct platform_driver pwm_sifive_driver = {
343341
.probe = pwm_sifive_probe,
344-
.remove = pwm_sifive_remove,
342+
.remove_new = pwm_sifive_remove,
345343
.driver = {
346344
.name = "pwm-sifive",
347345
.of_match_table = pwm_sifive_of_match,

0 commit comments

Comments
 (0)