From: Liang He Date: Tue, 19 Jul 2022 12:49:55 +0000 (+0800) Subject: iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop X-Git-Tag: v6.6.17~6865^2^5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a91eb6803c1c715738682fece095145cbd68fe0b;p=platform%2Fkernel%2Flinux-rpi.git 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") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220719124955.1242171-1-windhl@126.com Signed-off-by: Will Deacon --- diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c index 4c077c3..c11d2c2c 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -750,9 +750,12 @@ 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")) + for_each_child_of_node(qcom_iommu->dev->of_node, child) { + if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec")) { + of_node_put(child); return true; + } + } return false; }