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

memory: tegra124-emc: simplify with scoped for each OF child loop

Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20240816-cleanup-h-of-node-put-memory-v2-8-9eed0ee16b78@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

+2 -5
+2 -5
drivers/memory/tegra/tegra124-emc.c
··· 992 992 struct device_node *node) 993 993 { 994 994 int child_count = of_get_child_count(node); 995 - struct device_node *child; 996 995 struct emc_timing *timing; 997 996 unsigned int i = 0; 998 997 int err; ··· 1003 1004 1004 1005 emc->num_timings = child_count; 1005 1006 1006 - for_each_child_of_node(node, child) { 1007 + for_each_child_of_node_scoped(node, child) { 1007 1008 timing = &emc->timings[i++]; 1008 1009 1009 1010 err = load_one_timing_from_dt(emc, timing, child); 1010 - if (err) { 1011 - of_node_put(child); 1011 + if (err) 1012 1012 return err; 1013 - } 1014 1013 } 1015 1014 1016 1015 sort(emc->timings, emc->num_timings, sizeof(*timing), cmp_timings,