clocksource: Fix refcount leak bug in time-ti-dm-systimer
PATCH 1/1 clocksource: Fix refcount leak bug in time-ti-dm-systimer
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 <[email protected]>
--- drivers/clocksource/timer-ti-dm-systimer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clocksource/timer-ti-dm-systimer.c +2 -1
@@ -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 */
Signature · 1 line
2.25.1