Skip to content

Commit a31438e

Browse files
Uwe Kleine-Königsre
authored andcommitted
power: reset: at91-poweroff: 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/20231104211501.3676352-21-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 904e582 commit a31438e

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/power/reset/at91-poweroff.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static int at91_poweroff_probe(struct platform_device *pdev)
202202
return ret;
203203
}
204204

205-
static int at91_poweroff_remove(struct platform_device *pdev)
205+
static void at91_poweroff_remove(struct platform_device *pdev)
206206
{
207207
if (pm_power_off == at91_poweroff)
208208
pm_power_off = NULL;
@@ -211,8 +211,6 @@ static int at91_poweroff_remove(struct platform_device *pdev)
211211
iounmap(at91_shdwc.mpddrc_base);
212212

213213
clk_disable_unprepare(at91_shdwc.sclk);
214-
215-
return 0;
216214
}
217215

218216
static const struct of_device_id at91_poweroff_of_match[] = {
@@ -225,7 +223,7 @@ MODULE_DEVICE_TABLE(of, at91_poweroff_of_match);
225223

226224
static struct platform_driver at91_poweroff_driver = {
227225
.probe = at91_poweroff_probe,
228-
.remove = at91_poweroff_remove,
226+
.remove_new = at91_poweroff_remove,
229227
.driver = {
230228
.name = "at91-poweroff",
231229
.of_match_table = at91_poweroff_of_match,

0 commit comments

Comments
 (0)