Skip to content

Commit 8d28066

Browse files
charleskeepaxbroonie
authored andcommitted
ASoC: wm_adsp: Use new snd_compr_stop_error to signal stream failure
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 <[email protected]> Reviewed-by: Vinod Koul <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 7a75c0d commit 8d28066

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sound/soc/codecs/wm_adsp.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3043,6 +3043,7 @@ int wm_adsp_compr_pointer(struct snd_compr_stream *stream,
30433043
}
30443044

30453045
if (compr->buf->error) {
3046+
snd_compr_stop_error(stream, SNDRV_PCM_STATE_XRUN);
30463047
ret = -EIO;
30473048
goto out;
30483049
}
@@ -3060,8 +3061,12 @@ int wm_adsp_compr_pointer(struct snd_compr_stream *stream,
30603061
*/
30613062
if (buf->avail < wm_adsp_compr_frag_words(compr)) {
30623063
ret = wm_adsp_buffer_get_error(buf);
3063-
if (ret < 0)
3064+
if (ret < 0) {
3065+
if (compr->buf->error)
3066+
snd_compr_stop_error(stream,
3067+
SNDRV_PCM_STATE_XRUN);
30643068
goto out;
3069+
}
30653070

30663071
ret = wm_adsp_buffer_reenable_irq(buf);
30673072
if (ret < 0) {
@@ -3159,8 +3164,10 @@ static int wm_adsp_compr_read(struct wm_adsp_compr *compr,
31593164
if (!compr->buf)
31603165
return -ENXIO;
31613166

3162-
if (compr->buf->error)
3167+
if (compr->buf->error) {
3168+
snd_compr_stop_error(compr->stream, SNDRV_PCM_STATE_XRUN);
31633169
return -EIO;
3170+
}
31643171

31653172
count /= WM_ADSP_DATA_WORD_SIZE;
31663173

0 commit comments

Comments
 (0)