ASoC: wm_adsp: Check for buffer in trigger stop

Trigger stop can be called in situations where trigger start failed
and as such it can't be assumed the buffer is already attached to
the compressed stream or a NULL pointer may be dereferenced.

Fixes: 639e5eb3c7 ("ASoC: wm_adsp: Correct handling of compressed streams that restart")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Charles Keepax 2019-04-02 13:49:14 +01:00 committed by Mark Brown
parent 6e3bfcff19
commit 43d147be57
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -3587,7 +3587,8 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd)
} }
break; break;
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
wm_adsp_buffer_clear(compr->buf); if (wm_adsp_compr_attached(compr))
wm_adsp_buffer_clear(compr->buf);
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;