All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: staging: board: Add missing of_node_put() in board.c
@ 2022-06-15 14:21 Liang He
  2022-06-15 14:26 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-06-15 14:21 UTC (permalink / raw)
  To: gregkh, geert+renesas; +Cc: linux-staging, linux-kernel, windhl

In board_staging_gic_setup_xlate(), of_find_compatible_node() return
a node pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.

Signed-off-by: Liang He <windhl@126.com>
---
 drivers/staging/board/board.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c
index f980af037345..408448c202a2 100644
--- a/drivers/staging/board/board.c
+++ b/drivers/staging/board/board.c
@@ -67,6 +67,8 @@ int __init board_staging_gic_setup_xlate(const char *gic_match,
 	if (!irqc_node)
 		return -ENOENT;
 
+	of_node_put(irqc_node);
+
 	irqc_base = base;
 	return 0;
 }
-- 
2.25.1


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

* Re: [PATCH] drivers: staging: board: Add missing of_node_put() in board.c
  2022-06-15 14:21 [PATCH] drivers: staging: board: Add missing of_node_put() in board.c Liang He
@ 2022-06-15 14:26 ` Geert Uytterhoeven
  0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2022-06-15 14:26 UTC (permalink / raw)
  To: Liang He; +Cc: Greg KH, linux-staging, Linux Kernel Mailing List

Hi Liang,

On Wed, Jun 15, 2022 at 4:21 PM Liang He <windhl@126.com> wrote:
> In board_staging_gic_setup_xlate(), of_find_compatible_node() return
> a node pointer with refcount incremented. We should use of_node_put()
> when it is not used anymore.
>
> Signed-off-by: Liang He <windhl@126.com>

Thanks for your patch!

> --- a/drivers/staging/board/board.c
> +++ b/drivers/staging/board/board.c
> @@ -67,6 +67,8 @@ int __init board_staging_gic_setup_xlate(const char *gic_match,
>         if (!irqc_node)
>                 return -ENOENT;
>
> +       of_node_put(irqc_node);
> +
>         irqc_base = base;
>         return 0;
>  }

irqc_node is a global variable, and it is used after this function
has returned.

NAKed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 14:21 [PATCH] drivers: staging: board: Add missing of_node_put() in board.c Liang He
2022-06-15 14:26 ` Geert Uytterhoeven

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.