]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fpga: zynqpl: fix buffer alignment
authorMichael Walle <michael@walle.cc>
Wed, 10 Feb 2021 21:42:29 +0000 (22:42 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 23 Feb 2021 13:56:55 +0000 (14:56 +0100)
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 <michael@walle.cc>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/fpga/zynqpl.c

index a11e4855253471d614e0eb7f0462237cb27f530a..2de40109a814db7e8248e98b50009da5192ad2f1 100644 (file)
@@ -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);