Skip to content

Commit 54c2cb2

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

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/rtc/rtc-stm32.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ static int stm32_rtc_probe(struct platform_device *pdev)
846846
return ret;
847847
}
848848

849-
static int stm32_rtc_remove(struct platform_device *pdev)
849+
static void stm32_rtc_remove(struct platform_device *pdev)
850850
{
851851
struct stm32_rtc *rtc = platform_get_drvdata(pdev);
852852
const struct stm32_rtc_registers *regs = &rtc->data->regs;
@@ -869,8 +869,6 @@ static int stm32_rtc_remove(struct platform_device *pdev)
869869

870870
dev_pm_clear_wake_irq(&pdev->dev);
871871
device_init_wakeup(&pdev->dev, false);
872-
873-
return 0;
874872
}
875873

876874
#ifdef CONFIG_PM_SLEEP
@@ -917,7 +915,7 @@ static SIMPLE_DEV_PM_OPS(stm32_rtc_pm_ops,
917915

918916
static struct platform_driver stm32_rtc_driver = {
919917
.probe = stm32_rtc_probe,
920-
.remove = stm32_rtc_remove,
918+
.remove_new = stm32_rtc_remove,
921919
.driver = {
922920
.name = DRIVER_NAME,
923921
.pm = &stm32_rtc_pm_ops,

0 commit comments

Comments
 (0)