mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liang He <windhl@126.com>
To: daniel.lezcano@linaro.org, tglx@linutronix.de,
	linux-kernel@vger.kernel.org, windhl@126.com
Subject: [PATCH] clocksource: Fix refcount leak bug in time-ti-dm-systimer
Date: Fri, 17 Jun 2022 21:32:09 +0800	[thread overview]
Message-ID: <20220617133209.4049325-1-windhl@126.com> (raw)

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


                 reply	other threads:[~2022-06-17 13:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220617133209.4049325-1-windhl@126.com \
    --to=windhl@126.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®