Skip to contentSkip to conversation

iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop

PATCH Applied Liang He 2 participants 2 messages Jul 19, 2022

Subsystems (4)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop

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")
---
 drivers/iommu/arm/arm-smmu/qcom_iommu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu/qcom_iommu.c +3 -1
index 4a922c7b69ee..b6f90d5b7541 100644
@@ -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;
 }
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Liang He

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,

Signature · 5 lines
Will

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