Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx> --- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c index b98a7a598b89..18a4568f0aaa 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -764,14 +764,10 @@ static struct platform_driver qcom_iommu_ctx_driver = { 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) { + for_each_child_of_node_scoped(qcom_iommu->dev->of_node, child) { if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec") || - of_device_is_compatible(child, "qcom,msm-iommu-v2-sec")) { - of_node_put(child); + of_device_is_compatible(child, "qcom,msm-iommu-v2-sec")) return true; - } } return false; -- 2.34.1