[RFC] soc_pcm_open: error path behavior change since v5.6

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Sep 7 01:11:48 CEST 2020


Hi Cezary

> static int soc_pcm_open(struct snd_pcm_substream *substream)
> {
> 
> (...)
> 
> 	/* startup the audio subsystem */
> 	for_each_rtd_dais(rtd, i, dai) {
> 		ret = snd_soc_dai_startup(dai, substream);
> 		if (ret < 0) {
> 			dev_err(dai->dev,
> 				"ASoC: can't open DAI %s: %d\n",
> 				dai->name, ret);
> 			goto config_err;
> 		}
> 
> 		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> 			dai->tx_mask = 0;
> 		else
> 			dai->rx_mask = 0;
> 	}
> 
> (...)
> 
> config_err:
> 	for_each_rtd_dais(rtd, i, dai)
> 		snd_soc_dai_shutdown(dai, substream);
> 
> -
> 
> Let's assume we have 10 dais. In newer kernels, if
> snd_soc_dai_startup() fails at i=5, error path will attempt to perform
> snd_soc_dai_shutdown() for all dais (all 10) regardless if respective
> dai was opened or not. This is a clear behavior change when compared
> to v5.6 where cpu_dai was cleaned-up only if it was previously started
> successfully. Due to usage of for_each_rtd_codec_dai_rollback macro,
> the same applies to codec_dais.

Oh, yes. We need _rollback() for it.
I will try to fix it

Thank you for your help !!

Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list