linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Liang He <windhl@126.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.9 12/30] arm: mach-spear: Add missing of_node_put() in time.c
Date: Mon, 26 Sep 2022 12:11:43 +0200	[thread overview]
Message-ID: <20220926100736.617492501@linuxfoundation.org> (raw)
In-Reply-To: <20220926100736.153157100@linuxfoundation.org>

From: Liang He <windhl@126.com>

[ Upstream commit 2c629dd2d14fd7f64a553f809eda6d0b3a4f615a ]

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>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/r/20220616093027.3984903-1-windhl@126.com'
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/mach-spear/time.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c
index aaaa6781b9fe..57b77c7effa9 100644
--- a/arch/arm/mach-spear/time.c
+++ b/arch/arm/mach-spear/time.c
@@ -223,13 +223,13 @@ void __init spear_setup_of_timer(void)
 	irq = irq_of_parse_and_map(np, 0);
 	if (!irq) {
 		pr_err("%s: No irq passed for timer via DT\n", __func__);
-		return;
+		goto err_put_np;
 	}
 
 	gpt_base = of_iomap(np, 0);
 	if (!gpt_base) {
 		pr_err("%s: of iomap failed\n", __func__);
-		return;
+		goto err_put_np;
 	}
 
 	gpt_clk = clk_get_sys("gpt0", NULL);
@@ -244,6 +244,8 @@ void __init spear_setup_of_timer(void)
 		goto err_prepare_enable_clk;
 	}
 
+	of_node_put(np);
+
 	spear_clockevent_init(irq);
 	spear_clocksource_init();
 
@@ -253,4 +255,6 @@ void __init spear_setup_of_timer(void)
 	clk_put(gpt_clk);
 err_iomap:
 	iounmap(gpt_base);
+err_put_np:
+	of_node_put(np);
 }
-- 
2.35.1




  parent reply	other threads:[~2022-09-26 10:19 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 10:11 [PATCH 4.9 00/30] 4.9.330-rc1 review Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 01/30] parisc: ccio-dma: Add missing iounmap in error path in ccio_probe() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 02/30] cifs: dont send down the destination address to sendmsg for a SOCK_STREAM Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 03/30] drm/vc4: crtc: Use an union to store the page flip callback Greg Kroah-Hartman
2022-09-26 10:38   ` Pavel Machek
2022-09-26 16:11     ` Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 04/30] video: fbdev: skeletonfb: Fix syntax errors in comments Greg Kroah-Hartman
2022-09-26 10:28   ` Pavel Machek
2022-09-26 13:46     ` Bagas Sanjaya
2022-09-26 16:06     ` Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 05/30] video: fbdev: intelfb: Use aperture size from pci_resource_len Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 06/30] video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 07/30] video: fbdev: simplefb: Check before clk_put() not needed Greg Kroah-Hartman
2022-09-26 10:29   ` Pavel Machek
2022-09-26 16:09     ` Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 08/30] mips: lantiq: falcon: Fix refcount leak bug in sysctrl Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 09/30] mips: lantiq: xway: " Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 10/30] mips/pic32/pic32mzda: Fix refcount leak bugs Greg Kroah-Hartman
2022-09-26 10:40   ` Pavel Machek
2022-09-26 16:08     ` Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 11/30] mips: lantiq: Add missing of_node_put() in irq.c Greg Kroah-Hartman
2022-09-26 10:11 ` Greg Kroah-Hartman [this message]
2022-09-26 10:11 ` [PATCH 4.9 13/30] wifi: mac80211: Fix UAF in ieee80211_scan_rx() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 14/30] USB: core: Fix RST error in hub.c Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 15/30] ALSA: hda/tegra: set depop delay for tegra Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 16/30] ALSA: hda: add Intel 5 Series / 3400 PCI DID Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 17/30] mm/slub: fix to return errno if kmalloc() fails Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 18/30] netfilter: nf_conntrack_sip: fix ct_sip_walk_headers Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 19/30] netfilter: nf_conntrack_irc: Tighten matching on DCC message Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 20/30] ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 21/30] net: team: Unsync device addresses on ndo_stop Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 22/30] MIPS: lantiq: export clk_get_io() for lantiq_wdt.ko Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 23/30] can: gs_usb: gs_can_open(): fix race dev->can.state condition Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 24/30] perf kcore_copy: Do not check /proc/modules is unchanged Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 25/30] net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 26/30] serial: Create uart_xmit_advance() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 27/30] serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.9 28/30] s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.9 29/30] Drivers: hv: Never allocate anything besides framebuffer from framebuffer memory region Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.9 30/30] ext4: make directory inode spreading reflect flexbg size Greg Kroah-Hartman
2022-09-26 13:35 ` [PATCH 4.9 00/30] 4.9.330-rc1 review Pavel Machek
2022-09-27  1:02 ` Shuah Khan

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=20220926100736.617492501@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=windhl@126.com \
    /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;
as well as URLs for NNTP newsgroup(s).