From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Liang He <windhl@126.com>, Viresh Kumar <viresh.kumar@linaro.org>,
Arnd Bergmann <arnd@arndb.de>, Sasha Levin <sashal@kernel.org>,
vireshk@kernel.org, shiraz.linux.kernel@gmail.com,
soc@kernel.org, linux@armlinux.org.uk,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 4.9 13/13] arm: mach-spear: Add missing of_node_put() in time.c
Date: Mon, 27 Jun 2022 22:26:57 -0400 [thread overview]
Message-ID: <20220628022657.597208-13-sashal@kernel.org> (raw)
In-Reply-To: <20220628022657.597208-1-sashal@kernel.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
WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Liang He <windhl@126.com>, Viresh Kumar <viresh.kumar@linaro.org>,
Arnd Bergmann <arnd@arndb.de>, Sasha Levin <sashal@kernel.org>,
vireshk@kernel.org, shiraz.linux.kernel@gmail.com,
soc@kernel.org, linux@armlinux.org.uk,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 4.9 13/13] arm: mach-spear: Add missing of_node_put() in time.c
Date: Mon, 27 Jun 2022 22:26:57 -0400 [thread overview]
Message-ID: <20220628022657.597208-13-sashal@kernel.org> (raw)
In-Reply-To: <20220628022657.597208-1-sashal@kernel.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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-28 2:27 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 2:26 [PATCH AUTOSEL 4.9 01/13] spi: spi-cadence: Fix SPI CS gets toggling sporadically Sasha Levin
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 02/13] spi: cadence: Detect transmit FIFO depth Sasha Levin
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 03/13] drm/vc4: crtc: Use an union to store the page flip callback Sasha Levin
2022-06-28 2:26 ` Sasha Levin
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 04/13] drivers/net/ethernet/neterion/vxge: Fix a use-after-free bug in vxge-main.c Sasha Levin
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 05/13] video: fbdev: skeletonfb: Fix syntax errors in comments Sasha Levin
2022-06-28 2:26 ` Sasha Levin
2022-06-29 13:03 ` Pavel Machek
2022-06-29 13:03 ` Pavel Machek
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 06/13] video: fbdev: intelfb: Use aperture size from pci_resource_len Sasha Levin
2022-06-28 2:26 ` Sasha Levin
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 07/13] video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write Sasha Levin
2022-06-28 2:26 ` Sasha Levin
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 08/13] video: fbdev: simplefb: Check before clk_put() not needed Sasha Levin
2022-06-28 2:26 ` Sasha Levin
2022-06-29 13:04 ` Pavel Machek
2022-06-29 13:04 ` Pavel Machek
2022-06-30 19:31 ` Geert Uytterhoeven
2022-06-30 19:31 ` Geert Uytterhoeven
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 09/13] mips: lantiq: falcon: Fix refcount leak bug in sysctrl Sasha Levin
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 10/13] mips: lantiq: xway: " Sasha Levin
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 11/13] mips/pic32/pic32mzda: Fix refcount leak bugs Sasha Levin
2022-06-29 13:06 ` Pavel Machek
2022-06-29 13:23 ` Liang He
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 12/13] mips: lantiq: Add missing of_node_put() in irq.c Sasha Levin
2022-06-28 2:26 ` Sasha Levin [this message]
2022-06-28 2:26 ` [PATCH AUTOSEL 4.9 13/13] arm: mach-spear: Add missing of_node_put() in time.c Sasha Levin
-- strict thread matches above, loose matches on Subject: below --
2022-09-14 9:05 [PATCH AUTOSEL 4.9 01/13] spi: spi-cadence: Fix SPI CS gets toggling sporadically Sasha Levin
2022-09-14 9:05 ` [PATCH AUTOSEL 4.9 13/13] arm: mach-spear: Add missing of_node_put() in time.c Sasha Levin
2022-09-14 9:05 ` Sasha Levin
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=20220628022657.597208-13-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=arnd@arndb.de \
--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=stable@vger.kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=vireshk@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.