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

memory: tegra30-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-10-9eed0ee16b78@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

+2 -5
+2 -5
drivers/memory/tegra/tegra30-emc.c
··· 979 979 static int emc_load_timings_from_dt(struct tegra_emc *emc, 980 980 struct device_node *node) 981 981 { 982 - struct device_node *child; 983 982 struct emc_timing *timing; 984 983 int child_count; 985 984 int err; ··· 997 998 emc->num_timings = child_count; 998 999 timing = emc->timings; 999 1000 1000 - for_each_child_of_node(node, child) { 1001 + for_each_child_of_node_scoped(node, child) { 1001 1002 err = load_one_timing_from_dt(emc, timing++, child); 1002 - if (err) { 1003 - of_node_put(child); 1003 + if (err) 1004 1004 return err; 1005 - } 1006 1005 } 1007 1006 1008 1007 sort(emc->timings, emc->num_timings, sizeof(*timing), cmp_timings,