From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: "Dan Carpenter" <dan.carpenter@linaro.org>
Cc: linux-sound@vger.kernel.org
Subject: Re: [bug report] ASoC: audio-graph-card2: add Codec2Codec support
Date: Fri, 10 May 2024 08:47:19 +0900 [thread overview]
Message-ID: <877cg2r1iw.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <241354da-20c4-4ef0-90f7-68d6c4ee13d4@moroto.mountain>
Hi Dan
> > > 1201 struct device_node *ep0 = port_to_endpoint(port0);
> > > 1202 struct device_node *ep1 = port_to_endpoint(port1);
> > > 1203 struct device_node *codec0 = of_graph_get_remote_port(ep0);
> > > 1204 struct device_node *codec1 = of_graph_get_remote_port(ep1);
> > > 1205
> > > --> 1206 of_node_get(lnk);
> > >
> > > So this of_node_get() undoes the put. But if the reference count
> > > dropped to zero then this would be a use afer free.
> >
> > Thank you for pointing it.
> >
> > This "lnk" is used as "port0", and of_node_get(lnk) was for it,
> > but this function doesn't call of_node_put(port0).
> > So yes, indeed this of_node_get() is not needed.
> > Let's remove it.
>
> No no... of_get_next_child() will drop the reference. It is needed.
> The point is we should take the reference first before calling
> of_get_next_child().
>
> Maybe something like this:
>
> struct device_node *port1 = of_get_next_child(ports, of_node_get(lnk));
Oops, oh yes. It need to keep reference.
Thank you for your help, again. I will post fixup patch.
Best regards
---
Renesas Electronics
Ph.D. Kuninori Morimoto
prev parent reply other threads:[~2024-05-09 23:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-08 15:14 [bug report] ASoC: audio-graph-card2: add Codec2Codec support Dan Carpenter
2024-05-09 0:13 ` Kuninori Morimoto
2024-05-09 6:49 ` Dan Carpenter
2024-05-09 23:47 ` Kuninori Morimoto [this message]
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=877cg2r1iw.wl-kuninori.morimoto.gx@renesas.com \
--to=kuninori.morimoto.gx@renesas.com \
--cc=dan.carpenter@linaro.org \
--cc=linux-sound@vger.kernel.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).