[PATCH 3/6] ASoC: renesas: Use helper function for_each_child_of_node_scoped()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Thu May 22 09:43:34 AEST 2025


Hi Ai

Thank you for the patch

> The for_each_child_of_node_scoped() helper provides a scope-based
> clean-up functionality to put the device_node automatically, and
> as such, there is no need to call of_node_put() directly.
> 
> Thus, use this helper to simplify the code.
> 
> Signed-off-by: Ai Chao <aichao at kylinos.cn>
> ---
(snip)
> @@ -1270,16 +1263,15 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph)
>  
>  	of_node_put(node);
>  
> -	for_each_child_of_node(np, node) {
> -		if (!of_node_name_eq(node, RSND_NODE_DAI))
> +	for_each_child_of_node_scoped(np, ports) {
> +		if (!of_node_name_eq(ports, RSND_NODE_DAI))
>  			continue;
>  
> -		priv->component_dais[i] = of_get_child_count(node);
> +		priv->component_dais[i] = of_get_child_count(ports);
>  		nr += priv->component_dais[i];
>  		i++;
>  		if (i >= RSND_MAX_COMPONENT) {
>  			dev_info(dev, "reach to max component\n");
> -			of_node_put(node);
>  			break;
>  		}
>  	}

Here changes "node" to "ports", but please keep "node".
Here is checking "node" instead of "ports".

Except this

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

Thank you for your help !!

Best regards
---
Kuninori Morimoto


More information about the Linuxppc-dev mailing list