Skip to content

Commit a91b99f

Browse files
krzkrobherring
authored andcommitted
cpufreq: s5pv210: Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes to make code a bit simpler. Note that there is another part of code using "np" variable, so scoped loop should not shadow it. Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/20260109-of-for-each-compatible-scoped-v3-11-c22fa2c0749a@oss.qualcomm.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent 69c8cbb commit a91b99f

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

drivers/cpufreq/s5pv210-cpufreq.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -629,19 +629,17 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
629629
goto err_clock;
630630
}
631631

632-
for_each_compatible_node(np, NULL, "samsung,s5pv210-dmc") {
633-
id = of_alias_get_id(np, "dmc");
632+
for_each_compatible_node_scoped(dmc, NULL, "samsung,s5pv210-dmc") {
633+
id = of_alias_get_id(dmc, "dmc");
634634
if (id < 0 || id >= ARRAY_SIZE(dmc_base)) {
635-
dev_err(dev, "failed to get alias of dmc node '%pOFn'\n", np);
636-
of_node_put(np);
635+
dev_err(dev, "failed to get alias of dmc node '%pOFn'\n", dmc);
637636
result = id;
638637
goto err_clk_base;
639638
}
640639

641-
dmc_base[id] = of_iomap(np, 0);
640+
dmc_base[id] = of_iomap(dmc, 0);
642641
if (!dmc_base[id]) {
643642
dev_err(dev, "failed to map dmc%d registers\n", id);
644-
of_node_put(np);
645643
result = -EFAULT;
646644
goto err_dmc;
647645
}

0 commit comments

Comments
 (0)