Skip to content

Commit 054eb23

Browse files
Uwe Kleine-Königsre
authored andcommitted
power: reset: at91-sama5d2_shdwc: 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 <u.kleine-koenig@pengutronix.de> Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> Link: https://lore.kernel.org/r/20231105094712.3706799-4-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 20cea2b commit 054eb23

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/power/reset/at91-sama5d2_shdwc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static int at91_shdwc_probe(struct platform_device *pdev)
421421
return ret;
422422
}
423423

424-
static int at91_shdwc_remove(struct platform_device *pdev)
424+
static void at91_shdwc_remove(struct platform_device *pdev)
425425
{
426426
struct shdwc *shdw = platform_get_drvdata(pdev);
427427

@@ -437,13 +437,11 @@ static int at91_shdwc_remove(struct platform_device *pdev)
437437
iounmap(shdw->pmc_base);
438438

439439
clk_disable_unprepare(shdw->sclk);
440-
441-
return 0;
442440
}
443441

444442
static struct platform_driver at91_shdwc_driver = {
445443
.probe = at91_shdwc_probe,
446-
.remove = at91_shdwc_remove,
444+
.remove_new = at91_shdwc_remove,
447445
.driver = {
448446
.name = "at91-shdwc",
449447
.of_match_table = at91_shdwc_of_match,

0 commit comments

Comments
 (0)