diff options
author | Charles Keepax <ckeepax@opensource.cirrus.com> | 2019-04-02 14:49:14 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-04-03 05:52:12 +0200 |
commit | 43d147be5738a9ed6cfb25c285ac50d6dd5793be (patch) | |
tree | 08768eda4ebc7045967eec23106481d5d7737ffa | |
parent | ASoC: dapm: set power_check callback for widgets that shouldnt be always on (diff) | |
download | linux-43d147be5738a9ed6cfb25c285ac50d6dd5793be.tar.xz linux-43d147be5738a9ed6cfb25c285ac50d6dd5793be.zip |
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: 639e5eb3c7d6 ("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>
-rw-r--r-- | sound/soc/codecs/wm_adsp.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 5608ed5decca..b0b48eb9c7c9 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -3587,7 +3587,8 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd) } break; case SNDRV_PCM_TRIGGER_STOP: - wm_adsp_buffer_clear(compr->buf); + if (wm_adsp_compr_attached(compr)) + wm_adsp_buffer_clear(compr->buf); break; default: ret = -EINVAL; |