Browse Source

MLK-9760: ASoC: fsl_esai: fix NULL pointer issue in reset handler

When test with case arecord -Dhw:0,1 | aplay -Dhw:0,0, xrun happened,
the reset handler will be called, but for BE(backend) stream, the
substream->ops is null.
This patch is to fix this null pointer issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 4db112a8cd)
isee-imx_3.14.28.y
Shengjiu Wang 6 years ago
committed by Nitin Garg
parent
commit
327f048263
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      sound/soc/fsl/fsl_esai.c

+ 4
- 2
sound/soc/fsl/fsl_esai.c View File

@ -775,7 +775,8 @@ static int stop_lock_stream(struct snd_pcm_substream *substream)
{
if (substream) {
snd_pcm_stream_lock_irq(substream);
if (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING)
if (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING
&& substream->ops)
substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP);
}
return 0;
@ -784,7 +785,8 @@ static int stop_lock_stream(struct snd_pcm_substream *substream)
static int start_unlock_stream(struct snd_pcm_substream *substream)
{
if (substream) {
if (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING)
if (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING
&& substream->ops)
substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_START);
snd_pcm_stream_unlock_irq(substream);
}


Loading…
Cancel
Save