hda-dma: add missing check in hda_dma_avail_data_size

Adds missing check for buffer full in hda_dma_avail_data_size.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
Tomasz Lauda 2019-04-10 16:18:26 +02:00 committed by Liam Girdwood
parent 6e95ecefc8
commit bdd008f58e
1 changed files with 7 additions and 1 deletions

View File

@ -860,11 +860,17 @@ static int hda_dma_remove(struct dma *dma)
static int hda_dma_avail_data_size(struct hda_chan_data *chan) static int hda_dma_avail_data_size(struct hda_chan_data *chan)
{ {
uint32_t status;
int32_t read_ptr; int32_t read_ptr;
int32_t write_ptr; int32_t write_ptr;
int size; int size;
if (!(host_dma_reg_read(chan->dma, chan->index, DGCS) & DGCS_BNE)) status = host_dma_reg_read(chan->dma, chan->index, DGCS);
if (status & DGCS_BF)
return chan->buffer_bytes;
if (!(status & DGCS_BNE))
return 0; return 0;
read_ptr = host_dma_reg_read(chan->dma, chan->index, DGBRP); read_ptr = host_dma_reg_read(chan->dma, chan->index, DGBRP);