[alsa-devel] [PATCH v3 03/13] soundwire: Add support for port management

Vinod Koul vinod.koul at intel.com
Tue Apr 17 06:11:56 CEST 2018


On Mon, Apr 16, 2018 at 06:30:58PM -0500, Pierre-Louis Bossart wrote:

> >  int sdw_stream_remove_slave(struct sdw_slave *slave,
> >  		struct sdw_stream_runtime *stream)
> >  {
> >  	mutex_lock(&slave->bus->bus_lock);
> >+	sdw_slave_port_release(slave->bus, slave, stream);
> 
> Humm, does this work if the sdw_stream_remove_master() is called first?
> It'll call sdw_release_slave_stream() so you have lost the s_rt pointer by
> the time you want to call sdw_slave_port_release() so will never free the
> ports?
> 
> You will also have lost the stream->m_rt at that point. I believe the slave
> ports should be freed from sdw_release_slave_stream(). This call to
> sdw_slave_port_release comes too late if the master takes the initiative
> first to clean house.

Thanks for spotting I believe, we should either call
sdw_stream_remove_slave() here to remove port and slave runtime or add
remove port in sdw_release_master_stream as well for the case master removed
first.

Will check and update this.

-- 
~Vinod


More information about the Alsa-devel mailing list