Commit 07590111 authored by Lin Yujun's avatar Lin Yujun Committed by Alexandre Belloni

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: 1a71fb84 ("rtc: stmp3xxx: add wdt-accessor function")
Signed-off-by: default avatarLin Yujun <linyujun809@huawei.com>
Reviewed-by: default avatarWolfram Sang <wsa@kernel.org>
Link: https://lore.kernel.org/r/20220915065253.43668-1-linyujun809@huawei.comSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 25bcfaad
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment