Re: [bug report] ASoC: audio-graph-card2: add Codec2Codec support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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




[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux