Skip to contentSkip to conversation

drivers: staging: board: Add missing of_node_put() in board.c

PATCH In review Liang He 2 participants 2 messages Jun 15, 2022 Staging

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 drivers: staging: board: Add missing of_node_put() in board.c

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.

---
 drivers/staging/board/board.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/staging/board/board.c +2 -0
index f980af037345..408448c202a2 100644
@@ -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;
 }
Signature · 1 line
2.25.1
#1 lore raw

Hi Liang,

Quoted 5 lines · Liang He

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.

Thanks for your patch!

drivers/staging/board/board.c int __init board_staging_gic_setup_xlate(const char *gic_match, · line 74

Quoted 11 lines
drivers/staging/board/board.c +2 -0
@@ -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.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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