mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe
@ 2022-09-14  3:30 Lin Yujun
  2022-09-20  8:36 ` Daniel Lezcano
  2022-10-04  9:27 ` [tip: timers/core] " tip-bot2 for Lin Yujun
  0 siblings, 2 replies; 3+ messages in thread
From: Lin Yujun @ 2022-09-14  3:30 UTC (permalink / raw)
  To: verdun, nick.hawkins, daniel.lezcano, tglx, arnd; +Cc: linux-kernel

Add platform_device_put() to make sure to free the platform
device in the event platform_device_add() fails.

Fixes: 5184f4bf151b ("clocksource/drivers/timer-gxp: Add HPE GXP Timer")
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
---
 drivers/clocksource/timer-gxp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-gxp.c b/drivers/clocksource/timer-gxp.c
index 8b38b3212388..fe4fa8d7b3f1 100644
--- a/drivers/clocksource/timer-gxp.c
+++ b/drivers/clocksource/timer-gxp.c
@@ -171,6 +171,7 @@ static int gxp_timer_probe(struct platform_device *pdev)
 {
 	struct platform_device *gxp_watchdog_device;
 	struct device *dev = &pdev->dev;
+	int ret;
 
 	if (!gxp_timer) {
 		pr_err("Gxp Timer not initialized, cannot create watchdog");
@@ -187,7 +188,11 @@ static int gxp_timer_probe(struct platform_device *pdev)
 	gxp_watchdog_device->dev.platform_data = gxp_timer->counter;
 	gxp_watchdog_device->dev.parent = dev;
 
-	return platform_device_add(gxp_watchdog_device);
+	ret = platform_device_add(gxp_watchdog_device);
+	if (ret)
+		platform_device_put(gxp_watchdog_device);
+
+	return ret;
 }
 
 static const struct of_device_id gxp_timer_of_match[] = {
-- 
2.17.1


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

* Re: [PATCH -next] clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe
  2022-09-14  3:30 [PATCH -next] clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe Lin Yujun
@ 2022-09-20  8:36 ` Daniel Lezcano
  2022-10-04  9:27 ` [tip: timers/core] " tip-bot2 for Lin Yujun
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2022-09-20  8:36 UTC (permalink / raw)
  To: Lin Yujun, verdun, nick.hawkins, tglx, arnd; +Cc: linux-kernel

On 14/09/2022 05:30, Lin Yujun wrote:
> Add platform_device_put() to make sure to free the platform
> device in the event platform_device_add() fails.
> 
> Fixes: 5184f4bf151b ("clocksource/drivers/timer-gxp: Add HPE GXP Timer")
> Signed-off-by: Lin Yujun <linyujun809@huawei.com>
> ---

Applied, thanks

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [tip: timers/core] clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe
  2022-09-14  3:30 [PATCH -next] clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe Lin Yujun
  2022-09-20  8:36 ` Daniel Lezcano
@ 2022-10-04  9:27 ` tip-bot2 for Lin Yujun
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Lin Yujun @ 2022-10-04  9:27 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Lin Yujun, Daniel Lezcano, x86, linux-kernel

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     0e2c8e6d769bcdc4f6634a02c545356282275e68
Gitweb:        https://git.kernel.org/tip/0e2c8e6d769bcdc4f6634a02c545356282275e68
Author:        Lin Yujun <linyujun809@huawei.com>
AuthorDate:    Wed, 14 Sep 2022 11:30:18 +08:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Tue, 20 Sep 2022 10:49:45 +02:00

clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe

Add platform_device_put() to make sure to free the platform
device in the event platform_device_add() fails.

Fixes: 5184f4bf151b ("clocksource/drivers/timer-gxp: Add HPE GXP Timer")
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
Link: https://lore.kernel.org/r/20220914033018.97484-1-linyujun809@huawei.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/timer-gxp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-gxp.c b/drivers/clocksource/timer-gxp.c
index 8b38b32..fe4fa8d 100644
--- a/drivers/clocksource/timer-gxp.c
+++ b/drivers/clocksource/timer-gxp.c
@@ -171,6 +171,7 @@ static int gxp_timer_probe(struct platform_device *pdev)
 {
 	struct platform_device *gxp_watchdog_device;
 	struct device *dev = &pdev->dev;
+	int ret;
 
 	if (!gxp_timer) {
 		pr_err("Gxp Timer not initialized, cannot create watchdog");
@@ -187,7 +188,11 @@ static int gxp_timer_probe(struct platform_device *pdev)
 	gxp_watchdog_device->dev.platform_data = gxp_timer->counter;
 	gxp_watchdog_device->dev.parent = dev;
 
-	return platform_device_add(gxp_watchdog_device);
+	ret = platform_device_add(gxp_watchdog_device);
+	if (ret)
+		platform_device_put(gxp_watchdog_device);
+
+	return ret;
 }
 
 static const struct of_device_id gxp_timer_of_match[] = {

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

end of thread, other threads:[~2022-10-04  9:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14  3:30 [PATCH -next] clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe Lin Yujun
2022-09-20  8:36 ` Daniel Lezcano
2022-10-04  9:27 ` [tip: timers/core] " tip-bot2 for Lin Yujun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®