When using DMABUFs in the apf dma driver, there were specific
lengths that resulted in the transfer length being incorrectly
assigned. This patch corrects that by assigning lengths correctly
when the sg descriptor length is smaller than the transfer size.
Signed-off-by: Michael Gill <michael.gill@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
sglist = kmalloc_array(dp->dbuf_sg_table->nents,
sizeof(*sglist),
GFP_KERNEL);
- if (!dp->sg_list)
+ if (!sglist)
return -ENOMEM;
+
sg_init_table(sglist, dp->dbuf_sg_table->nents);
sgcnt = 0;
for_each_sg(dp->dbuf_sg_table->sgl,
sg_dma_len(sglist + i) = remaining_size;
sgcnt++;
} else {
+ sg_dma_len(sglist + i) = sg_dma_len(sg);
remaining_size -= sg_dma_len(sg);
sgcnt++;
}
struct dma_buf *dbuf;
struct dma_buf_attachment *dbuf_attach;
struct sg_table *dbuf_sg_table;
- struct scatterlist *sg_list;
- int sg_list_cnt;
int is_mapped;
int dma_direction;
struct list_head list;