Skip to content

Commit 88c31f1

Browse files
krzkmathieupoirier
authored andcommitted
remoteproc: xlnx_r5: Simplify with scoped for each OF child loop
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>
1 parent 6d183d0 commit 88c31f1

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

drivers/remoteproc/xlnx_r5_remoteproc.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,6 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
12711271
struct zynqmp_r5_core **r5_cores;
12721272
enum rpu_oper_mode fw_reg_val;
12731273
struct device **child_devs;
1274-
struct device_node *child;
12751274
enum rpu_tcm_comb tcm_mode;
12761275
int core_count, ret, i;
12771276
struct mbox_info *ipi;
@@ -1350,10 +1349,9 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
13501349
}
13511350

13521351
i = 0;
1353-
for_each_available_child_of_node(dev_node, child) {
1352+
for_each_available_child_of_node_scoped(dev_node, child) {
13541353
child_pdev = of_find_device_by_node(child);
13551354
if (!child_pdev) {
1356-
of_node_put(child);
13571355
ret = -ENODEV;
13581356
goto release_r5_cores;
13591357
}
@@ -1363,7 +1361,6 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
13631361
/* create and add remoteproc instance of type struct rproc */
13641362
r5_cores[i] = zynqmp_r5_add_rproc_core(&child_pdev->dev);
13651363
if (IS_ERR(r5_cores[i])) {
1366-
of_node_put(child);
13671364
ret = PTR_ERR(r5_cores[i]);
13681365
r5_cores[i] = NULL;
13691366
goto release_r5_cores;
@@ -1383,10 +1380,8 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
13831380
* If two child nodes are available in dts in lockstep mode,
13841381
* then ignore second child node.
13851382
*/
1386-
if (cluster_mode == LOCKSTEP_MODE) {
1387-
of_node_put(child);
1383+
if (cluster_mode == LOCKSTEP_MODE)
13881384
break;
1389-
}
13901385

13911386
i++;
13921387
}

0 commit comments

Comments
 (0)