Skip to content

Commit 0bda6b0

Browse files
Uwe Kleine-Königthierryreding
authored andcommitted
pwm: sun4i: 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> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
1 parent 000b97a commit 0bda6b0

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/pwm/pwm-sun4i.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,16 +477,14 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
477477
return ret;
478478
}
479479

480-
static int sun4i_pwm_remove(struct platform_device *pdev)
480+
static void sun4i_pwm_remove(struct platform_device *pdev)
481481
{
482482
struct sun4i_pwm_chip *sun4ichip = platform_get_drvdata(pdev);
483483

484484
pwmchip_remove(&sun4ichip->chip);
485485

486486
clk_disable_unprepare(sun4ichip->bus_clk);
487487
reset_control_assert(sun4ichip->rst);
488-
489-
return 0;
490488
}
491489

492490
static struct platform_driver sun4i_pwm_driver = {
@@ -495,7 +493,7 @@ static struct platform_driver sun4i_pwm_driver = {
495493
.of_match_table = sun4i_pwm_dt_ids,
496494
},
497495
.probe = sun4i_pwm_probe,
498-
.remove = sun4i_pwm_remove,
496+
.remove_new = sun4i_pwm_remove,
499497
};
500498
module_platform_driver(sun4i_pwm_driver);
501499

0 commit comments

Comments
 (0)