[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2ab4dcea-b365-cb1c-7ab4-67c9e39df83b@zonque.org>
Date: Wed, 15 Jun 2022 12:35:05 +0200
From: Daniel Mack <daniel@...que.org>
To: heliang <windhl@....com>, haojian.zhuang@...il.com,
robert.jarzmik@...e.fr, linux@...linux.org.uk
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [Re-PATCH] arch: arm: mach-pxa: Add missing of_node_put
in irq.c
On 6/15/22 12:33, 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. This goto-label patch
> style is advised by Daniel.
>
> Signed-off-by: heliang <windhl@....com>
Thanks for your patch!
Acked-by: Daniel Mack <daniel@...que.org>
> ---
> 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 */
Powered by blists - more mailing lists