fpga: zynqpl: fix buffer alignment
Subsystems (2)
PATCH 1/1 fpga: zynqpl: fix buffer alignment
Due to pointer arithmetic, "sizeof(u32) * ARCH_DMA_MINALIGN" is subtracted. It seems that the original intention was to just subtract ARCH_DMA_MINALIGN. Fix it.
Signed-off-by Michael Walle <[email protected]>
--- drivers/fpga/zynqpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/zynqpl.c +1 -1
@@ -315,7 +315,7 @@ static u32 *zynq_align_dma_buffer(u32 *buf, u32 len, u32 swap)if (new_buf > buf) {debug ("%s: Aligned buffer is after buffer start\n" , __func__); - new_buf -=ARCH_DMA_MINALIGN ; + new_buf = (u32 *)((u32 )new_buf -ARCH_DMA_MINALIGN ); }printf ("%s: Align buffer at %x to %x(swap %d)\n" , __func__, (u32 )buf, (u32 )new_buf, swap);
Signature · 1 line
2.20.1
Michal Simek
AppliedPATCH 1/1 fpga: zynqpl: fix buffer alignment
Quoted 15 lines · Michael Walle
Due to pointer arithmetic, "sizeof(u32) *
ARCH_DMA_MINALIGN" is subtracted. It seems that the original intention was to just subtractARCH_DMA_MINALIGN. Fix it.Signed-off-by Michael Walle <[email protected]>--- drivers/fpga/zynqpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/fpga/zynqpl.c +0
-0
drivers/fpga/zynqpl.c static u32 *zynq_align_dma_buffer(u32 *buf, u32 len, u32 swap) · line 321
Quoted 8 lines
drivers/fpga/zynqpl.c +1
-1@@ -315,7 +315,7 @@ static u32 *zynq_align_dma_buffer(u32 *buf, u32 len, u32 swap)if (new_buf > buf) {debug ("%s: Aligned buffer is after buffer start\n" , __func__); - new_buf -=ARCH_DMA_MINALIGN ; + new_buf = (u32 *)((u32 )new_buf -ARCH_DMA_MINALIGN ); }printf ("%s: Align buffer at %x to %x(swap %d)\n" , __func__, (u32 )buf, (u32 )new_buf, swap);
applied.
M