diff --git a/drivers/soundwire/generic_bandwidth_allocation.c b/drivers/soundwire/generic_bandwidth_allocation.c index d1035c18a980dc..1e381bff6353b0 100644 --- a/drivers/soundwire/generic_bandwidth_allocation.c +++ b/drivers/soundwire/generic_bandwidth_allocation.c @@ -190,6 +190,21 @@ static int sdw_compute_group_params(struct sdw_bus *bus, } list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) { + /* + * sdw_compute_group_params could be called in the deprepared case, skip the + * m_rt in that case. + */ + if (m_rt->stream == stream) + if (stream->state != SDW_STREAM_CONFIGURED) + continue; + /* + * Stream stage ENABLED and DISABLED are between PREPARED and DEPREPARED, + * We should count the bandwidth only for ENABLED and DISABLED stages. + */ + if (m_rt->stream->state != SDW_STREAM_ENABLED && + m_rt->stream->state != SDW_STREAM_DISABLED) + continue; + list_for_each_entry(p_rt, &m_rt->port_list, port_node) { rate = m_rt->stream->params.rate; bps = m_rt->stream->params.bps;