aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-stmp3xxx.c
diff options
context:
space:
mode:
authorLin Yujun <linyujun809@huawei.com>2022-09-15 14:52:53 +0800
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2022-10-13 00:03:11 +0200
commit0759011157b0d666b02b03b986d3de005d84027e (patch)
treee6e62188ceee59c005b208ecff30ca73584d924a /drivers/rtc/rtc-stmp3xxx.c
parent25bcfaad5ec4e82aede4270d4925967f8520d4cf (diff)
downloadlinux-0759011157b0d666b02b03b986d3de005d84027e.tar.gz
rtc: stmp3xxx: Add failure handling for stmp3xxx_wdt_register()
Use platform_device_put() to free platform device before print error message when platform_device_add() fails to run. Fixes: 1a71fb84fda6 ("rtc: stmp3xxx: add wdt-accessor function") Signed-off-by: Lin Yujun <linyujun809@huawei.com> Reviewed-by: Wolfram Sang <wsa@kernel.org> Link: https://lore.kernel.org/r/20220915065253.43668-1-linyujun809@huawei.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-stmp3xxx.c')
-rw-r--r--drivers/rtc/rtc-stmp3xxx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c
index 40c0f7ed36e06..aae40d20d0868 100644
--- a/drivers/rtc/rtc-stmp3xxx.c
+++ b/drivers/rtc/rtc-stmp3xxx.c
@@ -107,6 +107,8 @@ static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
wdt_pdev->dev.parent = &rtc_pdev->dev;
wdt_pdev->dev.platform_data = &wdt_pdata;
rc = platform_device_add(wdt_pdev);
+ if (rc)
+ platform_device_put(wdt_pdev);
}
if (rc)