mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] powerpc: embedded6xx: Fix refcount leak bugs
@ 2022-06-18  4:10 Liang He
  2022-09-09 12:07 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-06-18  4:10 UTC (permalink / raw)
  To: mpe, benh, paulus, christophe.leroy, npiggin, maz
  Cc: linuxppc-dev, linux-kernel, windhl

In xx_init_xx(), of_find_node_by_type() will 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>
---
 v2: we merge all embedded6xx related bugs into one commit
 v1: we only report the bug in holly_init_pci() of holly.c

 arch/powerpc/platforms/embedded6xx/holly.c        | 6 ++++++
 arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/arch/powerpc/platforms/embedded6xx/holly.c b/arch/powerpc/platforms/embedded6xx/holly.c
index 78f2378d9223..bebc5a972694 100644
--- a/arch/powerpc/platforms/embedded6xx/holly.c
+++ b/arch/powerpc/platforms/embedded6xx/holly.c
@@ -123,6 +123,8 @@ static void __init holly_init_pci(void)
 	if (np)
 		tsi108_setup_pci(np, HOLLY_PCI_CFG_PHYS, 1);
 
+	of_node_put(np);
+
 	ppc_md.pci_exclude_device = holly_exclude_device;
 	if (ppc_md.progress)
 		ppc_md.progress("tsi108: resources set", 0x100);
@@ -184,6 +186,9 @@ static void __init holly_init_IRQ(void)
 	tsi108_pci_int_init(cascade_node);
 	irq_set_handler_data(cascade_pci_irq, mpic);
 	irq_set_chained_handler(cascade_pci_irq, tsi108_irq_cascade);
+
+	of_node_put(tsi_pci);
+	of_node_put(cascade_node);
 #endif
 	/* Configure MPIC outputs to CPU0 */
 	tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0);
@@ -210,6 +215,7 @@ static void __noreturn holly_restart(char *cmd)
 	if (bridge) {
 		prop = of_get_property(bridge, "reg", &size);
 		addr = of_translate_address(bridge, prop);
+		of_node_put(bridge);
 	}
 	addr += (TSI108_PB_OFFSET + 0x414);
 
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
index 8b2b42210356..ddf0c652af80 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -135,6 +135,9 @@ static void __init mpc7448_hpc2_init_IRQ(void)
 	tsi108_pci_int_init(cascade_node);
 	irq_set_handler_data(cascade_pci_irq, mpic);
 	irq_set_chained_handler(cascade_pci_irq, tsi108_irq_cascade);
+
+	of_node_put(tsi_pci);
+	of_node_put(cascade_node);
 #endif
 	/* Configure MPIC outputs to CPU0 */
 	tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0);
-- 
2.25.1


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

* Re: [PATCH v2] powerpc: embedded6xx: Fix refcount leak bugs
  2022-06-18  4:10 [PATCH v2] powerpc: embedded6xx: Fix refcount leak bugs Liang He
@ 2022-09-09 12:07 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2022-09-09 12:07 UTC (permalink / raw)
  To: paulus, christophe.leroy, Liang He, npiggin, maz, benh, mpe
  Cc: linuxppc-dev, linux-kernel

On Sat, 18 Jun 2022 12:10:42 +0800, Liang He wrote:
> In xx_init_xx(), of_find_node_by_type() will return a node pointer
> with refcount incremented. We should use of_node_put() when it is
> not used anymore.
> 
> 

Applied to powerpc/next.

[1/1] powerpc: embedded6xx: Fix refcount leak bugs
      https://git.kernel.org/powerpc/c/6b2d17d514b105ecf486bdf011c444978e633085

cheers

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

end of thread, other threads:[~2022-09-09 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-18  4:10 [PATCH v2] powerpc: embedded6xx: Fix refcount leak bugs Liang He
2022-09-09 12:07 ` Michael Ellerman

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®