lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b36908bf35a20f7196bec4fe22e392a015d9b7d1.camel@sipsolutions.net>
Date: Mon, 26 May 2025 10:21:37 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Ai Chao <aichao@...inos.cn>, perex <perex@...ex.cz>, tiwai
 <tiwai@...e.com>,  "kuninori.morimoto.gx"
 <kuninori.morimoto.gx@...esas.com>, lgirdwood <lgirdwood@...il.com>,
 broonie <broonie@...nel.org>, jbrunet	 <jbrunet@...libre.com>,
 "neil.armstrong" <neil.armstrong@...aro.org>, khilman	
 <khilman@...libre.com>, "martin.blumenstingl"	
 <martin.blumenstingl@...glemail.com>, "shengjiu.wang"
 <shengjiu.wang@...il.com>,  "Xiubo.Lee" <Xiubo.Lee@...il.com>, festevam
 <festevam@...il.com>, nicoleotsuka <nicoleotsuka@...il.com>,  shawnguo
 <shawnguo@...nel.org>, "s.hauer" <s.hauer@...gutronix.de>,
 "srinivas.kandagatla"	 <srinivas.kandagatla@...aro.org>
Cc: linux-sound <linux-sound@...r.kernel.org>, linux-kernel	
 <linux-kernel@...r.kernel.org>, linuxppc-dev
 <linuxppc-dev@...ts.ozlabs.org>,  linux-renesas-soc
 <linux-renesas-soc@...r.kernel.org>, linux-arm-kernel
 <linux-arm-kernel@...ts.infradead.org>,  linux-amlogic
 <linux-amlogic@...ts.infradead.org>, imx <imx@...ts.linux.dev>, kernel
 <kernel@...gutronix.de>,  linux-arm-msm <linux-arm-msm@...r.kernel.org>
Subject: Re: [PATCH v2 2/6] ASoC: aoa: Use helper function
 for_each_child_of_node_scoped()

On Mon, 2025-05-26 at 16:20 +0800, Ai Chao wrote:
> Hi Johannes:
> > > Hi Johannes:
> > > 
> > > > > "simplifies the code" is no need to callof_node_put() .
> > > > Fair. Except that's not what you _actually_ changed here. Like I said,
> > > > either it's buggy before or after.
> > > > 
> > > In the function i2sbus_probe, it not return a struct device_node, so , I
> > > think function for_each_child_of_node_scoped is better than
> > > 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ