]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bus: qcom-ebi2: Simplify with scoped for each OF child loop
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Fri, 2 Jan 2026 12:50:31 +0000 (13:50 +0100)
committerBjorn Andersson <andersson@kernel.org>
Fri, 2 Jan 2026 19:59:31 +0000 (13:59 -0600)
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260102125030.65186-3-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/bus/qcom-ebi2.c

index c1fef1b4bd89be1a8d0b2cad3a3c6ce8dd458f16..be8166565e7cceae7e15c9b85de44980ad7c0eaa 100644 (file)
@@ -292,7 +292,6 @@ static void qcom_ebi2_setup_chipselect(struct device_node *np,
 static int qcom_ebi2_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
-       struct device_node *child;
        struct device *dev = &pdev->dev;
        struct resource *res;
        void __iomem *ebi2_base;
@@ -348,15 +347,13 @@ static int qcom_ebi2_probe(struct platform_device *pdev)
        writel(val, ebi2_base);
 
        /* Walk over the child nodes and see what chipselects we use */
-       for_each_available_child_of_node(np, child) {
+       for_each_available_child_of_node_scoped(np, child) {
                u32 csindex;
 
                /* Figure out the chipselect */
                ret = of_property_read_u32(child, "reg", &csindex);
-               if (ret) {
-                       of_node_put(child);
+               if (ret)
                        return ret;
-               }
 
                if (csindex > 5) {
                        dev_err(dev,