[PATCH v1 1/2] dma: ti: k3-udma: fix dma_addr_t typecasts
Kumar, Udit
u-kumar1 at ti.com
Thu Aug 28 10:50:00 CEST 2025
On 8/25/2025 7:02 PM, Anshul Dalal wrote:
> With the change to dma_addr_t from u32 to u64 for the R5 SPL, the
> existing typecasts from void* to int or vice-versa cause the compiler to
> throw a "cast from pointer to integer of different size".
is this some compiler specific ?. Please mention that
I don't see this warning
https://gist.github.com/uditkumarti/1c4238a7101d97cdc57b7a40d10147d2
I am on gcc version 11.3.1 20220712 (Arm GNU Toolchain 11.3.Rel1)
> Therefore this patch changes the casts to a uintptr_t which is
> guaranteed to hold any pointer value, thus supressing the compiler
> warning.
>
> Signed-off-by: Anshul Dalal <anshuld at ti.com>
> ---
> drivers/dma/ti/k3-udma.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 723265ab2e5..01824310995 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -2327,7 +2327,7 @@ static int udma_send(struct dma *dma, void *src, size_t len, void *metadata)
> {
> struct udma_dev *ud = dev_get_priv(dma->dev);
> struct cppi5_host_desc_t *desc_tx;
> - dma_addr_t dma_src = (dma_addr_t)src;
> + dma_addr_t dma_src = (uintptr_t)src;
> struct ti_udma_drv_packet_data packet_data = { 0 };
> dma_addr_t paddr;
> struct udma_chan *uc;
> @@ -2426,7 +2426,7 @@ static int udma_receive(struct dma *dma, void **dst, void *metadata)
>
> cppi5_desc_get_tags_ids(&desc_rx->hdr, &port_id, NULL);
>
> - *dst = (void *)buf_dma;
> + *dst = (void *)(uintptr_t)buf_dma;
> uc->num_rx_bufs--;
>
> return pkt_len;
> @@ -2518,7 +2518,7 @@ int udma_prepare_rcv_buf(struct dma *dma, void *dst, size_t size)
>
> desc_num = uc->desc_rx_cur % UDMA_RX_DESC_NUM;
> desc_rx = uc->desc_rx + (desc_num * uc->config.hdesc_size);
> - dma_dst = (dma_addr_t)dst;
> + dma_dst = (uintptr_t)dst;
>
> cppi5_hdesc_reset_hbdesc(desc_rx);
>
More information about the U-Boot
mailing list