Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clk: imx: imx31: 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-9-c22fa2c0749a@oss.qualcomm.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Rob Herring (Arm)
122b6c28 f82fa1d5

+2 -5
+2 -5
drivers/clk/imx/clk-imx31.c
··· 123 123 124 124 static void __init mx31_clocks_init_dt(struct device_node *np) 125 125 { 126 - struct device_node *osc_np; 127 126 u32 fref = 26000000; /* default */ 128 127 void __iomem *ccm; 129 128 130 - for_each_compatible_node(osc_np, NULL, "fixed-clock") { 129 + for_each_compatible_node_scoped(osc_np, NULL, "fixed-clock") { 131 130 if (!of_device_is_compatible(osc_np, "fsl,imx-osc26m")) 132 131 continue; 133 132 134 - if (!of_property_read_u32(osc_np, "clock-frequency", &fref)) { 135 - of_node_put(osc_np); 133 + if (!of_property_read_u32(osc_np, "clock-frequency", &fref)) 136 134 break; 137 - } 138 135 } 139 136 140 137 ccm = of_iomap(np, 0);