aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2020-06-11 13:41:58 +0100
committerVinod Koul <vkoul@kernel.org>2020-07-13 09:45:44 +0530
commit964fe060bd73037f751a91def4d80c7785d2b39c (patch)
tree830abadfc5f47f9c94aa223b81540a94ba00cc80
parentf95c6ec5aabf20ea53f77d6ce74b28fd647535b8 (diff)
downloadkernel-964fe060bd73037f751a91def4d80c7785d2b39c.tar.gz
ASoC: q6asm-dai: check available buffer size before sending
This patch add simple check before sending data buffer to dsp which will ensure that we are not sending any buffers which are not already available. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
-rw-r--r--sound/soc/qcom/qdsp6/q6asm-dai.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
index c3558288242a..b2316fcf9461 100644
--- a/sound/soc/qcom/qdsp6/q6asm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
@@ -534,13 +534,12 @@ static void compress_event_handler(uint32_t opcode, uint32_t token,
prtd->copied_total += bytes_written;
snd_compr_fragment_elapsed(substream);
- if (prtd->state != Q6ASM_STREAM_RUNNING) {
+ avail = prtd->bytes_received - prtd->bytes_sent;
+ if (prtd->state != Q6ASM_STREAM_RUNNING || avail <= 0) {
spin_unlock_irqrestore(&prtd->lock, flags);
break;
}
- avail = prtd->bytes_received - prtd->bytes_sent;
-
if (avail >= prtd->pcm_count) {
q6asm_write_async(prtd->audio_client, prtd->stream_id,
prtd->pcm_count, 0, 0, 0);