All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch: arm: mach-pxa: Add missing of_node_put in irq.c
@ 2022-06-15  9:12 ` heliang
  0 siblings, 0 replies; 4+ messages in thread
From: heliang @ 2022-06-15  9:12 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.

Signed-off-by: heliang <windhl@126.com>
---
 arch/arm/mach-pxa/irq.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index 96f33ef1d9ea..a81e9ffb77af 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -246,12 +246,14 @@ void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int))
 	ret = of_property_read_u32(node, "marvell,intc-nr-irqs",
 				   &pxa_internal_irq_nr);
 	if (ret) {
+		of_node_put(node);
 		pr_err("Not found marvell,intc-nr-irqs property\n");
 		return;
 	}
 
 	ret = of_address_to_resource(node, 0, &res);
 	if (ret < 0) {
+		of_node_put(node);
 		pr_err("No registers defined for node\n");
 		return;
 	}
@@ -262,10 +264,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) {
+		of_node_put(node);
 		pr_err("Failed to allocate IRQ numbers\n");
 		return;
 	}
 
 	pxa_init_irq_common(node, pxa_internal_irq_nr, fn);
+	of_node_put(node);
 }
 #endif /* CONFIG_OF */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] arch: arm: mach-pxa: Add missing of_node_put in irq.c
@ 2022-06-15  9:12 ` heliang
  0 siblings, 0 replies; 4+ messages in thread
From: heliang @ 2022-06-15  9:12 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.

Signed-off-by: heliang <windhl@126.com>
---
 arch/arm/mach-pxa/irq.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index 96f33ef1d9ea..a81e9ffb77af 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -246,12 +246,14 @@ void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int))
 	ret = of_property_read_u32(node, "marvell,intc-nr-irqs",
 				   &pxa_internal_irq_nr);
 	if (ret) {
+		of_node_put(node);
 		pr_err("Not found marvell,intc-nr-irqs property\n");
 		return;
 	}
 
 	ret = of_address_to_resource(node, 0, &res);
 	if (ret < 0) {
+		of_node_put(node);
 		pr_err("No registers defined for node\n");
 		return;
 	}
@@ -262,10 +264,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) {
+		of_node_put(node);
 		pr_err("Failed to allocate IRQ numbers\n");
 		return;
 	}
 
 	pxa_init_irq_common(node, pxa_internal_irq_nr, fn);
+	of_node_put(node);
 }
 #endif /* CONFIG_OF */
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] arch: arm: mach-pxa: Add missing of_node_put in irq.c
  2022-06-15  9:12 ` heliang
@ 2022-06-15  9:49   ` Daniel Mack
  -1 siblings, 0 replies; 4+ messages in thread
From: Daniel Mack @ 2022-06-15  9:49 UTC (permalink / raw)
  To: heliang, haojian.zhuang, robert.jarzmik, linux
  Cc: linux-arm-kernel, linux-kernel

Hi,

On 6/15/22 11:12, heliang wrote:
> 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.
> 
> Signed-off-by: heliang <windhl@126.com>
> ---
>  arch/arm/mach-pxa/irq.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
> index 96f33ef1d9ea..a81e9ffb77af 100644
> --- a/arch/arm/mach-pxa/irq.c
> +++ b/arch/arm/mach-pxa/irq.c
> @@ -246,12 +246,14 @@ void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int))
>  	ret = of_property_read_u32(node, "marvell,intc-nr-irqs",
>  				   &pxa_internal_irq_nr);
>  	if (ret) {
> +		of_node_put(node);
>  		pr_err("Not found marvell,intc-nr-irqs property\n");
>  		return;

How about jumping to a label here instead of a plain "return"?

>  	}
>  
>  	ret = of_address_to_resource(node, 0, &res);
>  	if (ret < 0) {
> +		of_node_put(node);
>  		pr_err("No registers defined for node\n");
>  		return;

Same here.

>  	}
> @@ -262,10 +264,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) {
> +		of_node_put(node);
>  		pr_err("Failed to allocate IRQ numbers\n");
>  		return;

And here.

>  	}
>  
>  	pxa_init_irq_common(node, pxa_internal_irq_nr, fn);

Jump target would go here.

> +	of_node_put(node);
>  }
>  #endif /* CONFIG_OF */


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arch: arm: mach-pxa: Add missing of_node_put in irq.c
@ 2022-06-15  9:49   ` Daniel Mack
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Mack @ 2022-06-15  9:49 UTC (permalink / raw)
  To: heliang, haojian.zhuang, robert.jarzmik, linux
  Cc: linux-arm-kernel, linux-kernel

Hi,

On 6/15/22 11:12, heliang wrote:
> 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.
> 
> Signed-off-by: heliang <windhl@126.com>
> ---
>  arch/arm/mach-pxa/irq.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
> index 96f33ef1d9ea..a81e9ffb77af 100644
> --- a/arch/arm/mach-pxa/irq.c
> +++ b/arch/arm/mach-pxa/irq.c
> @@ -246,12 +246,14 @@ void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int))
>  	ret = of_property_read_u32(node, "marvell,intc-nr-irqs",
>  				   &pxa_internal_irq_nr);
>  	if (ret) {
> +		of_node_put(node);
>  		pr_err("Not found marvell,intc-nr-irqs property\n");
>  		return;

How about jumping to a label here instead of a plain "return"?

>  	}
>  
>  	ret = of_address_to_resource(node, 0, &res);
>  	if (ret < 0) {
> +		of_node_put(node);
>  		pr_err("No registers defined for node\n");
>  		return;

Same here.

>  	}
> @@ -262,10 +264,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) {
> +		of_node_put(node);
>  		pr_err("Failed to allocate IRQ numbers\n");
>  		return;

And here.

>  	}
>  
>  	pxa_init_irq_common(node, pxa_internal_irq_nr, fn);

Jump target would go here.

> +	of_node_put(node);
>  }
>  #endif /* CONFIG_OF */


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-15  9:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15  9:12 [PATCH] arch: arm: mach-pxa: Add missing of_node_put in irq.c heliang
2022-06-15  9:12 ` heliang
2022-06-15  9:49 ` Daniel Mack
2022-06-15  9:49   ` Daniel Mack

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.