From: heliang <windhl@126.com>
To: daniel@zonque.org, haojian.zhuang@gmail.com,
robert.jarzmik@free.fr, linux@armlinux.org.uk
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, windhl@126.com
Subject: [PATCH] [Re-PATCH] arch: arm: mach-pxa: Add missing of_node_put in irq.c
Date: Wed, 15 Jun 2022 18:33:32 +0800 [thread overview]
Message-ID: <20220615103332.3963303-1-windhl@126.com> (raw)
In pxa_dt_irq_init(), of_find_matching_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. This goto-label patch
style is advised by Daniel.
Signed-off-by: heliang <windhl@126.com>
---
arch/arm/mach-pxa/irq.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index 96f33ef1d9ea..338356b9f37c 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -247,13 +247,13 @@ void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int))
&pxa_internal_irq_nr);
if (ret) {
pr_err("Not found marvell,intc-nr-irqs property\n");
- return;
+ goto out_put;
}
ret = of_address_to_resource(node, 0, &res);
if (ret < 0) {
pr_err("No registers defined for node\n");
- return;
+ goto out_put;
}
pxa_irq_base = io_p2v(res.start);
@@ -263,9 +263,12 @@ void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int))
ret = irq_alloc_descs(-1, 0, pxa_internal_irq_nr, 0);
if (ret < 0) {
pr_err("Failed to allocate IRQ numbers\n");
- return;
+ goto out_put;
}
pxa_init_irq_common(node, pxa_internal_irq_nr, fn);
+
+out_put:
+ of_node_put(node);
}
#endif /* CONFIG_OF */
--
2.25.1
next reply other threads:[~2022-06-15 10:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-15 10:33 heliang [this message]
2022-06-15 10:35 ` Daniel Mack
2022-06-15 10:42 ` Conor Dooley
[not found] ` <202206151925336656862@126.com>
2022-06-15 11:25 ` Conor Dooley
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=20220615103332.3963303-1-windhl@126.com \
--to=windhl@126.com \
--cc=daniel@zonque.org \
--cc=haojian.zhuang@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=robert.jarzmik@free.fr \
/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®