From: Johannes Berg <johannes@sipsolutions.net>
To: Ai Chao <aichao@kylinos.cn>, perex <perex@perex.cz>,
tiwai <tiwai@suse.com>,
"kuninori.morimoto.gx" <kuninori.morimoto.gx@renesas.com>,
lgirdwood <lgirdwood@gmail.com>, broonie <broonie@kernel.org>,
jbrunet <jbrunet@baylibre.com>,
"neil.armstrong" <neil.armstrong@linaro.org>,
khilman <khilman@baylibre.com>,
"martin.blumenstingl" <martin.blumenstingl@googlemail.com>,
"shengjiu.wang" <shengjiu.wang@gmail.com>,
"Xiubo.Lee" <Xiubo.Lee@gmail.com>, festevam <festevam@gmail.com>,
nicoleotsuka <nicoleotsuka@gmail.com>,
shawnguo <shawnguo@kernel.org>,
"s.hauer" <s.hauer@pengutronix.de>,
"srinivas.kandagatla" <srinivas.kandagatla@linaro.org>
Cc: linux-sound <linux-sound@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
linux-renesas-soc <linux-renesas-soc@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linux-amlogic <linux-amlogic@lists.infradead.org>,
imx <imx@lists.linux.dev>, kernel <kernel@pengutronix.de>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH v2 2/6] ASoC: aoa: Use helper function for_each_child_of_node_scoped()
Date: Mon, 26 May 2025 10:21:37 +0200 [thread overview]
Message-ID: <b36908bf35a20f7196bec4fe22e392a015d9b7d1.camel@sipsolutions.net> (raw)
In-Reply-To: <9ec008a8-b569-4ad1-9206-fe241fb1712d@kylinos.cn>
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
next prev parent reply other threads:[~2025-05-26 8:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2aq0nyvyf7t-2aq4hsc7kp6@nsmail7.0.0--kylin--1>
2025-05-23 10:40 ` Johannes Berg
2025-05-26 8:12 ` Ai Chao
2025-05-26 8:13 ` Johannes Berg
2025-05-26 8:20 ` Ai Chao
2025-05-26 8:21 ` Johannes Berg [this message]
2025-05-30 9:30 ` Ai Chao
2025-05-28 19:23 ` Dmitry Baryshkov
2025-05-22 5:02 [PATCH v2 0/6] " Ai Chao
2025-05-22 5:02 ` [PATCH v2 2/6] ASoC: aoa: " Ai Chao
2025-05-22 10:04 ` Johannes Berg
2025-05-23 10:51 ` Christophe Leroy
2025-05-26 8:53 ` Ai Chao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b36908bf35a20f7196bec4fe22e392a015d9b7d1.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=Xiubo.Lee@gmail.com \
--cc=aichao@kylinos.cn \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jbrunet@baylibre.com \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=neil.armstrong@linaro.org \
--cc=nicoleotsuka@gmail.com \
--cc=perex@perex.cz \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=shengjiu.wang@gmail.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®