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

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

+2 -5
+2 -5
drivers/memory/tegra/tegra20-emc.c
··· 410 410 static int tegra_emc_load_timings_from_dt(struct tegra_emc *emc, 411 411 struct device_node *node) 412 412 { 413 - struct device_node *child; 414 413 struct emc_timing *timing; 415 414 int child_count; 416 415 int err; ··· 427 428 428 429 timing = emc->timings; 429 430 430 - for_each_child_of_node(node, child) { 431 + for_each_child_of_node_scoped(node, child) { 431 432 if (of_node_name_eq(child, "lpddr2")) 432 433 continue; 433 434 434 435 err = load_one_timing_from_dt(emc, timing++, child); 435 - if (err) { 436 - of_node_put(child); 436 + if (err) 437 437 return err; 438 - } 439 438 440 439 emc->num_timings++; 441 440 }