Skip to content

Commit

Permalink
ASoC: soc-dai: don't call trigger ops if the stream is not valid
Browse files Browse the repository at this point in the history
soc_dai_trigger may be called when the stream is not valid.
We should not call the trigger ops in that case to avoid unexpected
behavior or unintended side effects.

Signed-off-by: Bard Liao <[email protected]>
  • Loading branch information
bardliao committed Jun 21, 2023
1 parent 2776754 commit 7840c5b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/soc/soc-dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,9 @@ static int soc_dai_trigger(struct snd_soc_dai *dai,
{
int ret = 0;

if (!snd_soc_dai_stream_valid(dai, substream->stream))
return 0;

if (dai->driver->ops &&
dai->driver->ops->trigger)
ret = dai->driver->ops->trigger(substream, cmd, dai);
Expand Down

0 comments on commit 7840c5b

Please sign in to comment.