Commit a91b99fa authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Rob Herring (Arm)
Browse files

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: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarJonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: default avatarKrzysztof 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: default avatarRob Herring (Arm) <robh@kernel.org>
parent 69c8cbb4
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -629,19 +629,17 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
		goto err_clock;
	}

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

		dmc_base[id] = of_iomap(np, 0);
		dmc_base[id] = of_iomap(dmc, 0);
		if (!dmc_base[id]) {
			dev_err(dev, "failed to map dmc%d registers\n", id);
			of_node_put(np);
			result = -EFAULT;
			goto err_dmc;
		}