Thread (7 messages) 7 messages, 3 authors, 2025-05-30

Re: [PATCH v2 2/6] ASoC: aoa: Use helper function for_each_child_of_node_scoped()

From: Ai Chao <hidden>
Date: 2025-05-30 09:31:10
Also in: imx, linux-amlogic, linux-arm-kernel, linux-arm-msm, linux-renesas-soc, linux-sound, lkml

Hi Johannes:
     Thanks for your feedback.  I will drop it.
On Mon, 2025-05-26 at 16:20 +0800, Ai Chao wrote:
quoted
Hi Johannes:
quoted
quoted
for_each_child_of_node.
You still haven't explained why it's even correct.

johannes
The for_each_child_of_node() function is used to iterate over all child
nodes of a device tree node.
During each iteration, it retrieves a pointer to the child node via
of_get_next_child() and automatically increments the node's reference
count (of_node_get()).
Each call to of_get_next_child() increases the reference count
(refcount) of the returned child node, ensuring that the node is not
freed while in use.
for_each_child_of_node() increments the child node's reference count in
each iteration but does not decrement it automatically.
If of_node_put() is not called manually, the reference count will never
reach zero, resulting in a memory leak of the node.
Yes, good! Now show that you can apply what you've learned to the
specific code (and changes) at hand.

johannes
-- 
Best regards,
Ai Chao

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help