Skip to content

Commit

Permalink
ASoC: wm_adsp: Use new snd_compr_stop_error to signal stream failure
Browse files Browse the repository at this point in the history
If we encounter a fatal error on the compressed stream call the new
snd_compr_stop_error to shutdown the stream and allow the core to
inform user-space that the stream is no longer valid.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Reviewed-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Charles Keepax authored and Mark Brown committed Jun 13, 2016
1 parent 7a75c0d commit 8d28066
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sound/soc/codecs/wm_adsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3043,6 +3043,7 @@ int wm_adsp_compr_pointer(struct snd_compr_stream *stream,
}

if (compr->buf->error) {
snd_compr_stop_error(stream, SNDRV_PCM_STATE_XRUN);
ret = -EIO;
goto out;
}
Expand All @@ -3060,8 +3061,12 @@ int wm_adsp_compr_pointer(struct snd_compr_stream *stream,
*/
if (buf->avail < wm_adsp_compr_frag_words(compr)) {
ret = wm_adsp_buffer_get_error(buf);
if (ret < 0)
if (ret < 0) {
if (compr->buf->error)
snd_compr_stop_error(stream,
SNDRV_PCM_STATE_XRUN);
goto out;
}

ret = wm_adsp_buffer_reenable_irq(buf);
if (ret < 0) {
Expand Down Expand Up @@ -3159,8 +3164,10 @@ static int wm_adsp_compr_read(struct wm_adsp_compr *compr,
if (!compr->buf)
return -ENXIO;

if (compr->buf->error)
if (compr->buf->error) {
snd_compr_stop_error(compr->stream, SNDRV_PCM_STATE_XRUN);
return -EIO;
}

count /= WM_ADSP_DATA_WORD_SIZE;

Expand Down

0 comments on commit 8d28066

Please sign in to comment.