Commit 327f0482 by Shengjiu Wang Committed by Nitin Garg

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: 's avatarShengjiu Wang <shengjiu.wang@freescale.com> (cherry picked from commit 4db112a8cd3caf5a553afea88cf7fe8d9781f459)
parent aed1f768
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment