mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] arch: arm: mach-pxa: Add missing of_node_put in irq.c
@ 2022-06-15 11:48 Liang He
  0 siblings, 0 replies; only message in thread
From: Liang He @ 2022-06-15 11:48 UTC (permalink / raw)
  To: daniel, haojian.zhuang, robert.jarzmik, linux
  Cc: linux-arm-kernel, linux-kernel, windhl

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: Liang He <windhl@126.com>
---
  changelog:
    v3: (1) use formal name (2) use -v N for format-patch (3) add
this changelog
    v2: use goto-label patch style advised by Daniel
    v1: add of_node_put in each fail path

 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..5d7dd307013e 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-15 11:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 11:48 [PATCH v3] arch: arm: mach-pxa: Add missing of_node_put in irq.c Liang He

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®