]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
remoteproc: xlnx_r5: Simplify with scoped for each OF child loop
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Fri, 2 Jan 2026 12:48:29 +0000 (13:48 +0100)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Mon, 5 Jan 2026 21:31:34 +0000 (14:31 -0700)
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>
Link: https://lore.kernel.org/r/20260102124827.64355-4-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
drivers/remoteproc/xlnx_r5_remoteproc.c

index a7b75235f53e4149bcc67170ba9d81b6e2b1c1c7..bd619a6c42aa8c31eb5db7f560aa922b32444e61 100644 (file)
@@ -1271,7 +1271,6 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
        struct zynqmp_r5_core **r5_cores;
        enum rpu_oper_mode fw_reg_val;
        struct device **child_devs;
-       struct device_node *child;
        enum rpu_tcm_comb tcm_mode;
        int core_count, ret, i;
        struct mbox_info *ipi;
@@ -1350,10 +1349,9 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
        }
 
        i = 0;
-       for_each_available_child_of_node(dev_node, child) {
+       for_each_available_child_of_node_scoped(dev_node, child) {
                child_pdev = of_find_device_by_node(child);
                if (!child_pdev) {
-                       of_node_put(child);
                        ret = -ENODEV;
                        goto release_r5_cores;
                }
@@ -1363,7 +1361,6 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
                /* create and add remoteproc instance of type struct rproc */
                r5_cores[i] = zynqmp_r5_add_rproc_core(&child_pdev->dev);
                if (IS_ERR(r5_cores[i])) {
-                       of_node_put(child);
                        ret = PTR_ERR(r5_cores[i]);
                        r5_cores[i] = NULL;
                        goto release_r5_cores;
@@ -1383,10 +1380,8 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
                 * If two child nodes are available in dts in lockstep mode,
                 * then ignore second child node.
                 */
-               if (cluster_mode == LOCKSTEP_MODE) {
-                       of_node_put(child);
+               if (cluster_mode == LOCKSTEP_MODE)
                        break;
-               }
 
                i++;
        }