All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart
@ 2022-04-25  8:12 ` Peng Wu
  0 siblings, 0 replies; 4+ messages in thread
From: Peng Wu @ 2022-04-25  8:12 UTC (permalink / raw)
  To: mpe, benh, nick.child
  Cc: linuxppc-dev, linux-kernel, liwei391, wangxiongfeng2, Peng Wu

The device_node pointer is returned by of_find_compatible_node
with refcount incremented. We should use of_node_put() to avoid
the refcount leak.

Signed-off-by: Peng Wu <wupeng58@huawei.com>
---
 arch/powerpc/sysdev/dart_iommu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index be6b99b1b352..9a02aed886a0 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -404,9 +404,10 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)
 	}
 
 	/* Initialize the DART HW */
-	if (dart_init(dn) != 0)
+	if (dart_init(dn) != 0) {
+		of_node_put(dn);
 		return;
-
+	}
 	/*
 	 * U4 supports a DART bypass, we use it for 64-bit capable devices to
 	 * improve performance.  However, that only works for devices connected
@@ -419,6 +420,7 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)
 
 	/* Setup pci_dma ops */
 	set_pci_dma_ops(&dma_iommu_ops);
+	of_node_put(dn);
 }
 
 #ifdef CONFIG_PM
-- 
2.17.1


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

* [PATCH -next] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart
@ 2022-04-25  8:12 ` Peng Wu
  0 siblings, 0 replies; 4+ messages in thread
From: Peng Wu @ 2022-04-25  8:12 UTC (permalink / raw)
  To: mpe, benh, nick.child
  Cc: Peng Wu, liwei391, linuxppc-dev, linux-kernel, wangxiongfeng2

The device_node pointer is returned by of_find_compatible_node
with refcount incremented. We should use of_node_put() to avoid
the refcount leak.

Signed-off-by: Peng Wu <wupeng58@huawei.com>
---
 arch/powerpc/sysdev/dart_iommu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index be6b99b1b352..9a02aed886a0 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -404,9 +404,10 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)
 	}
 
 	/* Initialize the DART HW */
-	if (dart_init(dn) != 0)
+	if (dart_init(dn) != 0) {
+		of_node_put(dn);
 		return;
-
+	}
 	/*
 	 * U4 supports a DART bypass, we use it for 64-bit capable devices to
 	 * improve performance.  However, that only works for devices connected
@@ -419,6 +420,7 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)
 
 	/* Setup pci_dma ops */
 	set_pci_dma_ops(&dma_iommu_ops);
+	of_node_put(dn);
 }
 
 #ifdef CONFIG_PM
-- 
2.17.1


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

* Re: [PATCH -next] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart
  2022-04-25  8:12 ` Peng Wu
@ 2022-05-24 11:09   ` Michael Ellerman
  -1 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2022-05-24 11:09 UTC (permalink / raw)
  To: benh, mpe, nick.child, Peng Wu
  Cc: wangxiongfeng2, liwei391, linuxppc-dev, linux-kernel

On Mon, 25 Apr 2022 08:12:45 +0000, Peng Wu wrote:
> The device_node pointer is returned by of_find_compatible_node
> with refcount incremented. We should use of_node_put() to avoid
> the refcount leak.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart
      https://git.kernel.org/powerpc/c/57b742a5b8945118022973e6416b71351df512fb

cheers

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

* Re: [PATCH -next] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart
@ 2022-05-24 11:09   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2022-05-24 11:09 UTC (permalink / raw)
  To: benh, mpe, nick.child, Peng Wu
  Cc: linuxppc-dev, liwei391, wangxiongfeng2, linux-kernel

On Mon, 25 Apr 2022 08:12:45 +0000, Peng Wu wrote:
> The device_node pointer is returned by of_find_compatible_node
> with refcount incremented. We should use of_node_put() to avoid
> the refcount leak.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart
      https://git.kernel.org/powerpc/c/57b742a5b8945118022973e6416b71351df512fb

cheers

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

end of thread, other threads:[~2022-05-24 11:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25  8:12 [PATCH -next] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart Peng Wu
2022-04-25  8:12 ` Peng Wu
2022-05-24 11:09 ` Michael Ellerman
2022-05-24 11:09   ` Michael Ellerman

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.