summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSricharan R <sricharan@codeaurora.org>2019-06-28 17:39:46 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-10 09:52:32 +0200
commitc68eb98ae2975cae25271e4f7334766c17686810 (patch)
treef26007421009bcf1ea1dd04fb8af8043eee4482a
parentb7948d98a058c46360d6af0139664e85860c9e2d (diff)
dmaengine: qcom: bam_dma: Fix completed descriptors count
commit f6034225442c4a87906d36e975fd9e99a8f95487 upstream. One space is left unused in circular FIFO to differentiate 'full' and 'empty' cases. So take that in to account while counting for the descriptors completed. Fixes the issue reported here, https://lkml.org/lkml/2019/6/18/669 Cc: stable@vger.kernel.org Reported-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/dma/qcom/bam_dma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index cb860cb53c27..d30f8bd434d5 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -808,6 +808,9 @@ static u32 process_channel_irqs(struct bam_device *bdev)
/* Number of bytes available to read */
avail = CIRC_CNT(offset, bchan->head, MAX_DESCRIPTORS + 1);
+ if (offset < bchan->head)
+ avail--;
+
list_for_each_entry_safe(async_desc, tmp,
&bchan->desc_list, desc_node) {
/* Not enough data to read */