public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Liang He <windhl@126.com>
To: vireshk@kernel.org, shiraz.linux.kernel@gmail.com,
	soc@kernel.org, linux@armlinux.org.uk
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, windhl@126.com
Subject: [PATCH] arch: arm: mach-spear: Add missing of_node_put() in time.c
Date: Wed, 15 Jun 2022 20:39:12 +0800	[thread overview]
Message-ID: <20220615123912.3965902-1-windhl@126.com> (raw)

In spear_setup_of_timer(), of_find_matching_node() will return a
node pointer with refcount incrementd. We should use of_node_put()
in each fail path or when it is not used anymore.

Signed-off-by: Liang He <windhl@126.com>
---
 arch/arm/mach-spear/time.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c
index d1fdb6066f7b..a1b6635b4ecb 100644
--- a/arch/arm/mach-spear/time.c
+++ b/arch/arm/mach-spear/time.c
@@ -217,16 +217,20 @@ void __init spear_setup_of_timer(void)
 
 	irq = irq_of_parse_and_map(np, 0);
 	if (!irq) {
+		of_node_put(np);
 		pr_err("%s: No irq passed for timer via DT\n", __func__);
 		return;
 	}
 
 	gpt_base = of_iomap(np, 0);
 	if (!gpt_base) {
+		of_node_put(np);
 		pr_err("%s: of iomap failed\n", __func__);
 		return;
 	}
-
+	
+	of_node_put(np);
+	
 	gpt_clk = clk_get_sys("gpt0", NULL);
 	if (IS_ERR(gpt_clk)) {
 		pr_err("%s:couldn't get clk for gpt\n", __func__);
-- 
2.25.1


             reply	other threads:[~2022-06-15 12:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15 12:39 Liang He [this message]
2022-06-16  6:06 ` [PATCH] arch: arm: mach-spear: Add missing of_node_put() in time.c Viresh Kumar
2022-06-16  6:25   ` Liang He

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=20220615123912.3965902-1-windhl@126.com \
    --to=windhl@126.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=shiraz.linux.kernel@gmail.com \
    --cc=soc@kernel.org \
    --cc=vireshk@kernel.org \
    /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