Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: SOF: Intel: hda-dai: Fix locking in hda_ipc4_pre_trigger()

hda_ipc4_pre_trigger() has two issues:
1. In the default case, we are returning without unlocking the mutex.
2. In case SNDRV_PCM_TRIGGER_STOP: when ret is less than zero it goes
to out, unlocks but returns zero instead of a negative value.

Fix this by changing the final return value to 'ret' instead of zero,
and initialize 'ret' to zero in the start of the function.

Fixes: 225f37b578a9 ("ASoC: SOF: ipc4-pcm: reset all pipelines during FE DAI hw_free")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230519064404.1659637-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Harshit Mogalapalli and committed by
Mark Brown
ed67a340 fcbc3aac

+3 -3
+3 -3
sound/soc/sof/intel/hda-dai-ops.c
··· 183 183 struct sof_ipc4_pipeline *pipeline; 184 184 struct snd_sof_widget *swidget; 185 185 struct snd_soc_dapm_widget *w; 186 - int ret; 186 + int ret = 0; 187 187 188 188 w = snd_soc_dai_get_widget(cpu_dai, substream->stream); 189 189 swidget = w->dobj.private; ··· 208 208 break; 209 209 default: 210 210 dev_err(sdev->dev, "unknown trigger command %d\n", cmd); 211 - return -EINVAL; 211 + ret = -EINVAL; 212 212 } 213 213 out: 214 214 mutex_unlock(&ipc4_data->pipeline_state_mutex); 215 - return 0; 215 + return ret; 216 216 } 217 217 218 218 static int hda_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai,