Skip to content

Commit d6f5250

Browse files
Uwe Kleine-Königalexandrebelloni
authored andcommitted
rtc: sunplus: 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> Link: https://lore.kernel.org/r/20230304133028.2135435-35-u.kleine-koenig@pengutronix.de Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 1632416 commit d6f5250

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/rtc/rtc-sunplus.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,13 @@ static int sp_rtc_probe(struct platform_device *plat_dev)
304304
return ret;
305305
}
306306

307-
static int sp_rtc_remove(struct platform_device *plat_dev)
307+
static void sp_rtc_remove(struct platform_device *plat_dev)
308308
{
309309
struct sunplus_rtc *sp_rtc = dev_get_drvdata(&plat_dev->dev);
310310

311311
device_init_wakeup(&plat_dev->dev, 0);
312312
reset_control_assert(sp_rtc->rstc);
313313
clk_disable_unprepare(sp_rtc->rtcclk);
314-
315-
return 0;
316314
}
317315

318316
#ifdef CONFIG_PM_SLEEP
@@ -347,7 +345,7 @@ static SIMPLE_DEV_PM_OPS(sp_rtc_pm_ops, sp_rtc_suspend, sp_rtc_resume);
347345

348346
static struct platform_driver sp_rtc_driver = {
349347
.probe = sp_rtc_probe,
350-
.remove = sp_rtc_remove,
348+
.remove_new = sp_rtc_remove,
351349
.driver = {
352350
.name = "sp7021-rtc",
353351
.of_match_table = sp_rtc_of_match,

0 commit comments

Comments
 (0)