Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH] iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop
@ 2022-07-19 12:49 Liang He
  2022-07-19 19:56 ` Will Deacon
  0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-07-19 12:49 UTC (permalink / raw)
  To: robdclark, will, robin.murphy, joro, iommu, linux-arm-msm, windhl

In qcom_iommu_has_secure_context(), we should call of_node_put()
for the reference 'child' when breaking out of for_each_child_of_node()
which will automatically increase and decrease the refcount.

Fixes: d051f28c8807 ("iommu/qcom: Initialize secure page table")
Signed-off-by: Liang He <windhl@126.com>
---
 drivers/iommu/arm/arm-smmu/qcom_iommu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
index 4a922c7b69ee..b6f90d5b7541 100644
--- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
+++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
@@ -740,8 +740,10 @@ static bool qcom_iommu_has_secure_context(struct qcom_iommu_dev *qcom_iommu)
 	struct device_node *child;
 
 	for_each_child_of_node(qcom_iommu->dev->of_node, child)
-		if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec"))
+		if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec")) {
+			of_node_put(child);
 			return true;
+		}
 
 	return false;
 }
-- 
2.25.1


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

* Re: [PATCH] iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop
  2022-07-19 12:49 [PATCH] iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop Liang He
@ 2022-07-19 19:56 ` Will Deacon
  0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2022-07-19 19:56 UTC (permalink / raw)
  To: robin.murphy, linux-arm-msm, iommu, joro, Liang He, robdclark
  Cc: catalin.marinas, kernel-team, Will Deacon

On Tue, 19 Jul 2022 20:49:55 +0800, Liang He wrote:
> In qcom_iommu_has_secure_context(), we should call of_node_put()
> for the reference 'child' when breaking out of for_each_child_of_node()
> which will automatically increase and decrease the refcount.
> 
> 

Applied to will (for-joerg/arm-smmu/updates), thanks!

[1/1] iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop
      https://git.kernel.org/will/c/a91eb6803c1c 

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

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

end of thread, other threads:[~2022-07-19 19:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-19 12:49 [PATCH] iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop Liang He
2022-07-19 19:56 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox