mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] clk: tegra: tegra124-emc: Simplify with scoped for each OF child loop
@ 2026-01-02 12:50 Krzysztof Kozlowski
  2026-01-02 16:08 ` Jon Hunter
  2026-01-17  0:11 ` Thierry Reding
  0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:50 UTC (permalink / raw)
  To: Peter De Schrijver, Prashant Gaikwad, Michael Turquette,
	Stephen Boyd, Thierry Reding, Jonathan Hunter, linux-clk,
	linux-tegra, linux-kernel
  Cc: Krzysztof Kozlowski

Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 drivers/clk/tegra/clk-tegra124-emc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/tegra/clk-tegra124-emc.c b/drivers/clk/tegra/clk-tegra124-emc.c
index 2a6db0434281..2953b62cb619 100644
--- a/drivers/clk/tegra/clk-tegra124-emc.c
+++ b/drivers/clk/tegra/clk-tegra124-emc.c
@@ -444,7 +444,6 @@ static int load_timings_from_dt(struct tegra_clk_emc *tegra,
 				u32 ram_code)
 {
 	struct emc_timing *timings_ptr;
-	struct device_node *child;
 	int child_count = of_get_child_count(node);
 	int i = 0, err;
 	size_t size;
@@ -458,12 +457,11 @@ static int load_timings_from_dt(struct tegra_clk_emc *tegra,
 	timings_ptr = tegra->timings + tegra->num_timings;
 	tegra->num_timings += child_count;
 
-	for_each_child_of_node(node, child) {
+	for_each_child_of_node_scoped(node, child) {
 		struct emc_timing *timing = timings_ptr + (i++);
 
 		err = load_one_timing_from_dt(tegra, timing, child);
 		if (err) {
-			of_node_put(child);
 			kfree(tegra->timings);
 			return err;
 		}
-- 
2.51.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] clk: tegra: tegra124-emc: Simplify with scoped for each OF child loop
  2026-01-02 12:50 [PATCH] clk: tegra: tegra124-emc: Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2026-01-02 16:08 ` Jon Hunter
  2026-01-17  0:11 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Jon Hunter @ 2026-01-02 16:08 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Peter De Schrijver, Prashant Gaikwad,
	Michael Turquette, Stephen Boyd, Thierry Reding, linux-clk,
	linux-tegra, linux-kernel


On 02/01/2026 12:50, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
>   drivers/clk/tegra/clk-tegra124-emc.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/tegra/clk-tegra124-emc.c b/drivers/clk/tegra/clk-tegra124-emc.c
> index 2a6db0434281..2953b62cb619 100644
> --- a/drivers/clk/tegra/clk-tegra124-emc.c
> +++ b/drivers/clk/tegra/clk-tegra124-emc.c
> @@ -444,7 +444,6 @@ static int load_timings_from_dt(struct tegra_clk_emc *tegra,
>   				u32 ram_code)
>   {
>   	struct emc_timing *timings_ptr;
> -	struct device_node *child;
>   	int child_count = of_get_child_count(node);
>   	int i = 0, err;
>   	size_t size;
> @@ -458,12 +457,11 @@ static int load_timings_from_dt(struct tegra_clk_emc *tegra,
>   	timings_ptr = tegra->timings + tegra->num_timings;
>   	tegra->num_timings += child_count;
>   
> -	for_each_child_of_node(node, child) {
> +	for_each_child_of_node_scoped(node, child) {
>   		struct emc_timing *timing = timings_ptr + (i++);
>   
>   		err = load_one_timing_from_dt(tegra, timing, child);
>   		if (err) {
> -			of_node_put(child);
>   			kfree(tegra->timings);
>   			return err;
>   		}


Reviewed-by: Jon Hunter <jonathanh@nvidia.com>

Thanks!
Jon

-- 
nvpublic


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] clk: tegra: tegra124-emc: Simplify with scoped for each OF child loop
  2026-01-02 12:50 [PATCH] clk: tegra: tegra124-emc: Simplify with scoped for each OF child loop Krzysztof Kozlowski
  2026-01-02 16:08 ` Jon Hunter
@ 2026-01-17  0:11 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2026-01-17  0:11 UTC (permalink / raw)
  To: Peter De Schrijver, Prashant Gaikwad, Michael Turquette,
	Stephen Boyd, Thierry Reding, Jonathan Hunter, linux-clk,
	linux-tegra, linux-kernel, Krzysztof Kozlowski

From: Thierry Reding <treding@nvidia.com>


On Fri, 02 Jan 2026 13:50:20 +0100, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
> 
> 

Applied, thanks!

[1/1] clk: tegra: tegra124-emc: Simplify with scoped for each OF child loop
      commit: 362b0c81b3a5a3d455577866cee6c300784a2ad8

Best regards,
-- 
Thierry Reding <treding@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-17  0:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-02 12:50 [PATCH] clk: tegra: tegra124-emc: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-02 16:08 ` Jon Hunter
2026-01-17  0:11 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®