Skip to content

Commit a91eb68

Browse files
windhlwilldeacon
authored andcommitted
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: d051f28 ("iommu/qcom: Initialize secure page table") Signed-off-by: Liang He <windhl@126.com> Link: https://lore.kernel.org/r/20220719124955.1242171-1-windhl@126.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent ef660de commit a91eb68

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/iommu/arm/arm-smmu/qcom_iommu.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,9 +750,12 @@ static bool qcom_iommu_has_secure_context(struct qcom_iommu_dev *qcom_iommu)
750750
{
751751
struct device_node *child;
752752

753-
for_each_child_of_node(qcom_iommu->dev->of_node, child)
754-
if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec"))
753+
for_each_child_of_node(qcom_iommu->dev->of_node, child) {
754+
if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec")) {
755+
of_node_put(child);
755756
return true;
757+
}
758+
}
756759

757760
return false;
758761
}

0 commit comments

Comments
 (0)