[alsa-devel] [PATCH v5 8/9] soundwire: Add support for multi link bank switch

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Tue Jul 10 01:22:26 CEST 2018


>   
> @@ -1170,6 +1276,17 @@ int sdw_stream_add_master(struct sdw_bus *bus,
>   
>   	stream->m_rt_count++;
>   
> +	/*
> +	 * For multi link streams, add the second master only if
> +	 * the bus supports it.
> +	 * Check if bus->multi_link is set
> +	 */
> +	if (!bus->multi_link && stream->m_rt_count > 1) {
> +		dev_err(bus->dev,
> +			"Multilink not supported, link %d", bus->link_id);
> +		goto stream_error;
> +	}
> +
>   	goto unlock;
>   
>   stream_error:
>

This error handling is a bit weird. It's make more sense to check 
upfront if there is already one m_rt allocated (m_rt_count > 0) and bail 
to avoid allocating/releasing a stream. Also there should be a return 
value set (-EINVAL?)


More information about the Alsa-devel mailing list