Skip to content

Commit 0759011

Browse files
Lin Yujunalexandrebelloni
authored andcommitted
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: 1a71fb8 ("rtc: stmp3xxx: add wdt-accessor function") Signed-off-by: Lin Yujun <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 25bcfaa commit 0759011

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/rtc/rtc-stmp3xxx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
107107
wdt_pdev->dev.parent = &rtc_pdev->dev;
108108
wdt_pdev->dev.platform_data = &wdt_pdata;
109109
rc = platform_device_add(wdt_pdev);
110+
if (rc)
111+
platform_device_put(wdt_pdev);
110112
}
111113

112114
if (rc)

0 commit comments

Comments
 (0)