Commit c7f67fec authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski

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: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20240816-cleanup-h-of-node-put-memory-v2-10-9eed0ee16b78@linaro.orgSigned-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
parent 818902cb
...@@ -979,7 +979,6 @@ static int emc_check_mc_timings(struct tegra_emc *emc) ...@@ -979,7 +979,6 @@ static int emc_check_mc_timings(struct tegra_emc *emc)
static int emc_load_timings_from_dt(struct tegra_emc *emc, static int emc_load_timings_from_dt(struct tegra_emc *emc,
struct device_node *node) struct device_node *node)
{ {
struct device_node *child;
struct emc_timing *timing; struct emc_timing *timing;
int child_count; int child_count;
int err; int err;
...@@ -998,13 +997,11 @@ static int emc_load_timings_from_dt(struct tegra_emc *emc, ...@@ -998,13 +997,11 @@ static int emc_load_timings_from_dt(struct tegra_emc *emc,
emc->num_timings = child_count; emc->num_timings = child_count;
timing = emc->timings; timing = emc->timings;
for_each_child_of_node(node, child) { for_each_child_of_node_scoped(node, child) {
err = load_one_timing_from_dt(emc, timing++, child); err = load_one_timing_from_dt(emc, timing++, child);
if (err) { if (err)
of_node_put(child);
return err; return err;
} }
}
sort(emc->timings, emc->num_timings, sizeof(*timing), cmp_timings, sort(emc->timings, emc->num_timings, sizeof(*timing), cmp_timings,
NULL); NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment