linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next v3] rtc: stmp3xxx: Add failure handling for stmp3xxx_wdt_register()
@ 2022-09-15  6:52 Lin Yujun
  2022-09-15  7:14 ` Wolfram Sang
  2022-10-12 22:05 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Lin Yujun @ 2022-09-15  6:52 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni, mcoquelin.stm32, alexandre.torgue,
	akpm, wsa, wim
  Cc: linux-rtc, linux-stm32, linux-arm-kernel, linux-kernel

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>
---
 drivers/rtc/rtc-stmp3xxx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c
index 40c0f7ed36e0..aae40d20d086 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)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next v3] rtc: stmp3xxx: Add failure handling for stmp3xxx_wdt_register()
  2022-09-15  6:52 [PATCH -next v3] rtc: stmp3xxx: Add failure handling for stmp3xxx_wdt_register() Lin Yujun
@ 2022-09-15  7:14 ` Wolfram Sang
  2022-10-12 22:05 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2022-09-15  7:14 UTC (permalink / raw)
  To: Lin Yujun
  Cc: a.zummo, alexandre.belloni, mcoquelin.stm32, alexandre.torgue,
	akpm, wim, linux-rtc, linux-stm32, linux-arm-kernel,
	linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 357 bytes --]

On Thu, Sep 15, 2022 at 02:52:53PM +0800, Lin Yujun wrote:
> 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>


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next v3] rtc: stmp3xxx: Add failure handling for stmp3xxx_wdt_register()
  2022-09-15  6:52 [PATCH -next v3] rtc: stmp3xxx: Add failure handling for stmp3xxx_wdt_register() Lin Yujun
  2022-09-15  7:14 ` Wolfram Sang
@ 2022-10-12 22:05 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2022-10-12 22:05 UTC (permalink / raw)
  To: wsa, akpm, a.zummo, Lin Yujun, wim, alexandre.torgue, mcoquelin.stm32
  Cc: linux-stm32, linux-arm-kernel, linux-kernel, linux-rtc

On Thu, 15 Sep 2022 14:52:53 +0800, Lin Yujun wrote:
> Use platform_device_put() to free platform device before print
> error message when platform_device_add() fails to run.
> 
> 

Applied, thanks!

[1/1] rtc: stmp3xxx: Add failure handling for stmp3xxx_wdt_register()
      commit: 0759011157b0d666b02b03b986d3de005d84027e

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-12 22:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15  6:52 [PATCH -next v3] rtc: stmp3xxx: Add failure handling for stmp3xxx_wdt_register() Lin Yujun
2022-09-15  7:14 ` Wolfram Sang
2022-10-12 22:05 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).