[PATCH] clocksource/drivers/timer-ti-dm: fix missing of_node_put
From: cgel . zte
Date: Thu Apr 07 2022 - 04:58:51 EST
From: Lv Ruyi <lv.ruyi@xxxxxxxxxx>
of_find_compatible_node returns node pointer with refcount incremented,
use of_node_put() on it when done.
Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Lv Ruyi <lv.ruyi@xxxxxxxxxx>
---
drivers/clocksource/timer-ti-dm-systimer.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksource/timer-ti-dm-systimer.c
index 2737407ff069..a58df7749db3 100644
--- a/drivers/clocksource/timer-ti-dm-systimer.c
+++ b/drivers/clocksource/timer-ti-dm-systimer.c
@@ -691,9 +691,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)) {
pr_warn_once("ARM architected timer wrap issue i940 detected\n");
+ of_node_put(arm_timer);
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