Skip to content

Commit 8d53a07

Browse files
pelwellpopcornmix
authored andcommitted
dmaengine: dw-axi-dmac: Fix alignment checks
Remove a bogus memory alignment check - transfers will be run bytewise if needed - and add a check that the overall length is multiple of the register size, otherwise there is residue. See: #6733 Signed-off-by: Phil Elwell <[email protected]>
1 parent a1be793 commit 8d53a07

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -750,11 +750,6 @@ static int dw_axi_dma_set_hw_desc(struct axi_dma_chan *chan,
750750

751751
mem_width = __ffs(data_width | mem_addr | len);
752752

753-
if (!IS_ALIGNED(mem_addr, 4)) {
754-
dev_err(chan->chip->dev, "invalid buffer alignment\n");
755-
return -EINVAL;
756-
}
757-
758753
/* Use a reasonable upper limit otherwise residue reporting granularity grows large */
759754
mem_burst_msize = axi_dma_encode_msize(16);
760755

@@ -799,6 +794,11 @@ static int dw_axi_dma_set_hw_desc(struct axi_dma_chan *chan,
799794
return -EINVAL;
800795
}
801796

797+
if (len % (1 << reg_width)) {
798+
dev_err_ratelimited(chan->chip->dev, "length %ld not aligned to device width %d\n", len, 1 << reg_width);
799+
return -EINVAL;
800+
}
801+
802802
if (block_ts > axi_block_ts)
803803
return -EINVAL;
804804

0 commit comments

Comments
 (0)