Skip to content

Commit 1632416

Browse files
Uwe Kleine-Königalexandrebelloni
authored andcommitted
rtc: stmp3xxx: 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-34-u.kleine-koenig@pengutronix.de Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 54c2cb2 commit 1632416

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

drivers/rtc/rtc-stmp3xxx.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,15 @@ static const struct rtc_class_ops stmp3xxx_rtc_ops = {
232232
.set_alarm = stmp3xxx_rtc_set_alarm,
233233
};
234234

235-
static int stmp3xxx_rtc_remove(struct platform_device *pdev)
235+
static void stmp3xxx_rtc_remove(struct platform_device *pdev)
236236
{
237237
struct stmp3xxx_rtc_data *rtc_data = platform_get_drvdata(pdev);
238238

239239
if (!rtc_data)
240-
return 0;
240+
return;
241241

242242
writel(STMP3XXX_RTC_CTRL_ALARM_IRQ_EN,
243243
rtc_data->io + STMP3XXX_RTC_CTRL + STMP_OFFSET_REG_CLR);
244-
245-
return 0;
246244
}
247245

248246
static int stmp3xxx_rtc_probe(struct platform_device *pdev)
@@ -406,7 +404,7 @@ MODULE_DEVICE_TABLE(of, rtc_dt_ids);
406404

407405
static struct platform_driver stmp3xxx_rtcdrv = {
408406
.probe = stmp3xxx_rtc_probe,
409-
.remove = stmp3xxx_rtc_remove,
407+
.remove_new = stmp3xxx_rtc_remove,
410408
.driver = {
411409
.name = "stmp3xxx-rtc",
412410
.pm = &stmp3xxx_rtc_pm_ops,

0 commit comments

Comments
 (0)