Skip to content

Commit f82fa1d

Browse files
krzkrobherring
authored andcommitted
clk: imx: imx27: Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes to make code a bit simpler. Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Acked-by: Abel Vesa <abelvesa@kernel.org> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/20260109-of-for-each-compatible-scoped-v3-8-c22fa2c0749a@oss.qualcomm.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent 3bf312f commit f82fa1d

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

drivers/clk/imx/clk-imx27.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,14 @@ static void __init _mx27_clocks_init(unsigned long fref)
171171

172172
static void __init mx27_clocks_init_dt(struct device_node *np)
173173
{
174-
struct device_node *refnp;
175174
u32 fref = 26000000; /* default */
176175

177-
for_each_compatible_node(refnp, NULL, "fixed-clock") {
176+
for_each_compatible_node_scoped(refnp, NULL, "fixed-clock") {
178177
if (!of_device_is_compatible(refnp, "fsl,imx-osc26m"))
179178
continue;
180179

181-
if (!of_property_read_u32(refnp, "clock-frequency", &fref)) {
182-
of_node_put(refnp);
180+
if (!of_property_read_u32(refnp, "clock-frequency", &fref))
183181
break;
184-
}
185182
}
186183

187184
ccm = of_iomap(np, 0);

0 commit comments

Comments
 (0)