summaryrefslogtreecommitdiff
path: root/drivers/memory/tegra
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2024-08-16 13:54:34 +0300
committerKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2024-08-21 14:23:35 +0300
commitc7f67fec177484fd4f7836e832e66e77fa25700f (patch)
tree6215167d01509c1070b6417749c5a65c7e4892e4 /drivers/memory/tegra
parent818902cb74c377ade67ce933f3bbd8305615a459 (diff)
downloadlinux-c7f67fec177484fd4f7836e832e66e77fa25700f.tar.xz
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>
Diffstat (limited to 'drivers/memory/tegra')
-rw-r--r--drivers/memory/tegra/tegra30-emc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/memory/tegra/tegra30-emc.c b/drivers/memory/tegra/tegra30-emc.c
index d7b0a23c2d7d..921dce1b8bc6 100644
--- a/drivers/memory/tegra/tegra30-emc.c
+++ b/drivers/memory/tegra/tegra30-emc.c
@@ -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,
struct device_node *node)
{
- struct device_node *child;
struct emc_timing *timing;
int child_count;
int err;
@@ -998,12 +997,10 @@ static int emc_load_timings_from_dt(struct tegra_emc *emc,
emc->num_timings = child_count;
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);
- if (err) {
- of_node_put(child);
+ if (err)
return err;
- }
}
sort(emc->timings, emc->num_timings, sizeof(*timing), cmp_timings,