All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource: Fix refcount leak bug in time-ti-dm-systimer
@ 2022-06-17 13:32 Liang He
  0 siblings, 0 replies; only message in thread
From: Liang He @ 2022-06-17 13:32 UTC (permalink / raw)
  To: daniel.lezcano, tglx, linux-kernel, windhl

In dmtimer_percpu_quirk_init(), of_find_compatible_node() will return
a node pointer with refcount incremented. We should use of_node_put()
in fail path or when it is not used anymore.

Signed-off-by: Liang He <windhl@126.com>
---
 drivers/clocksource/timer-ti-dm-systimer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksource/timer-ti-dm-systimer.c
index 2737407ff069..f414cb553649 100644
--- a/drivers/clocksource/timer-ti-dm-systimer.c
+++ b/drivers/clocksource/timer-ti-dm-systimer.c
@@ -690,10 +690,11 @@ static int __init dmtimer_percpu_quirk_init(struct device_node *np, u32 pa)
 
 	arm_timer = of_find_compatible_node(NULL, NULL, "arm,armv7-timer");
 	if (of_device_is_available(arm_timer)) {
+		of_node_put(arm_timer);
 		pr_warn_once("ARM architected timer wrap issue i940 detected\n");
 		return 0;
 	}
-
+	of_node_put(arm_timer);
 	if (pa == 0x4882c000)           /* dra7 dmtimer15 */
 		return dmtimer_percpu_timer_init(np, 0);
 	else if (pa == 0x4882e000)      /* dra7 dmtimer16 */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-17 13:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17 13:32 [PATCH] clocksource: Fix refcount leak bug in time-ti-dm-systimer Liang He

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.