Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ static void axi_desc_put(struct axi_dma_desc *desc)

for (descs_put = 0; descs_put < count; descs_put++) {
hw_desc = &desc->hw_desc[descs_put];
dma_pool_free(chan->desc_pool, hw_desc->lli, hw_desc->llp);
if (hw_desc->lli)
dma_pool_free(chan->desc_pool, hw_desc->lli, hw_desc->llp);
}

kfree(desc->hw_desc);
Expand Down Expand Up @@ -749,11 +750,6 @@ static int dw_axi_dma_set_hw_desc(struct axi_dma_chan *chan,

mem_width = __ffs(data_width | mem_addr | len);

if (!IS_ALIGNED(mem_addr, 4)) {
dev_err(chan->chip->dev, "invalid buffer alignment\n");
return -EINVAL;
}

/* Use a reasonable upper limit otherwise residue reporting granularity grows large */
mem_burst_msize = axi_dma_encode_msize(16);

Expand Down Expand Up @@ -798,6 +794,11 @@ static int dw_axi_dma_set_hw_desc(struct axi_dma_chan *chan,
return -EINVAL;
}

if (len % reg_width) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Thinking aloud, not an issue at the moment) I wonder if use-cases that have memory buffers spanning a page boundary with odd alignment are broken when using this driver - and this error message makes this case known.

But fixing this means rewriting dw_axi_dma_chan_prep_[cyclic|slave]_sg to dynamically allocate hardware descriptors inside for_each_sg().

dev_err(chan->chip->dev, "length not aligned to device width\n");
return -EINVAL;
}

if (block_ts > axi_block_ts)
return -EINVAL;

Expand Down