[PATCH] common: bouncebuf: Add missing cast to dma_addr_t
Andrew Davis
afd at ti.com
Mon Aug 14 14:59:32 CEST 2023
On 8/13/23 6:47 PM, Marek Vasut wrote:
> Fix the following warning produced on qemu-x86_64_defconfig:
>
> "
> common/bouncebuf.c: In function ‘bounce_buffer_stop’:
> common/bouncebuf.c:82:34: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> 82 | dma_unmap_single((dma_addr_t)state->bounce_buffer,
> | ^
> "
>
> The warning is valid, the pointer has to be up-cast first.
This is really a narrowing cast, void*/ulong are 64bit and dma_addr_t
is 32bit on x86 (assume this is always good enough?), anyway seems fine,
Reviewed-by: Andrew Davis <afd at ti.com>
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
> ---
> Cc: Andrew Davis <afd at ti.com>
> Cc: Simon Glass <sjg at chromium.org>
> ---
> common/bouncebuf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/bouncebuf.c b/common/bouncebuf.c
> index 93a35668cc2..934b83f7ec3 100644
> --- a/common/bouncebuf.c
> +++ b/common/bouncebuf.c
> @@ -79,7 +79,7 @@ int bounce_buffer_stop(struct bounce_buffer *state)
> {
> if (state->flags & GEN_BB_WRITE) {
> /* Invalidate cache so that CPU can see any newly DMA'd data */
> - dma_unmap_single((dma_addr_t)state->bounce_buffer,
> + dma_unmap_single((dma_addr_t)(uintptr_t)state->bounce_buffer,
> state->len_aligned,
> DMA_BIDIRECTIONAL);
> }
More information about the U-Boot
mailing list