lkml.org 
[lkml]   [2022]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] clocksource: Fix refcount leak bug in time-ti-dm-systimer
Date
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
\
 
 \ /
  Last update: 2022-06-17 15:34    [W:0.034 / U:0.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site