[PATCH v2] ASoC: core: Do not cleanup uninitialized dais on soc_pcm_open failure
Introduce for_each_rtd_dais_rollback macro which behaves exactly like for_each_codec_dais_rollback and its cpu_dais equivalent but for all dais instead.
Use newly added macro to fix soc_pcm_open error path and prevent uninitialized dais from being cleaned-up.
Signed-off-by: Cezary Rojewski cezary.rojewski@intel.com Fixes: 5d9fa03e6c35 ("ASoC: soc-pcm: tidyup soc_pcm_open() order") Acked-by: Liam Girdwood liam.r.girdwood@linux.intel.com Acked-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com ---
Changes in v2: - no functional changes - appended missing Fixes tag, plus Acked-by from review
include/sound/soc.h | 2 ++ sound/soc/soc-pcm.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h index b94ebff12350..09a7d8409ade 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1193,6 +1193,8 @@ struct snd_soc_pcm_runtime { ((i) < (rtd)->num_cpus + (rtd)->num_codecs) && \ ((dai) = (rtd)->dais[i]); \ (i)++) +#define for_each_rtd_dais_rollback(rtd, i, dai) \ + for (; (--(i) >= 0) && ((dai) = (rtd)->dais[i]);)
void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 00ac1cbf6f88..4c9d4cd8cf0b 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -812,7 +812,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) return 0;
config_err: - for_each_rtd_dais(rtd, i, dai) + for_each_rtd_dais_rollback(rtd, i, dai) snd_soc_dai_shutdown(dai, substream);
snd_soc_link_shutdown(substream);
On Mon, 7 Sep 2020 13:19:39 +0200, Cezary Rojewski wrote:
Introduce for_each_rtd_dais_rollback macro which behaves exactly like for_each_codec_dais_rollback and its cpu_dais equivalent but for all dais instead.
Use newly added macro to fix soc_pcm_open error path and prevent uninitialized dais from being cleaned-up.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: core: Do not cleanup uninitialized dais on soc_pcm_open failure commit: 20244b2a8a8728c63233d33146e007dcacbcc5c4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
Cezary Rojewski
-
Mark Brown