[PATCH 1/2] net: bcmgenet: fix warning when building for 32-bit

Sascha Hauer sha at pengutronix.de
Wed Jan 11 00:00:48 PST 2023


On Tue, Jan 10, 2023 at 07:01:25PM +0100, Ahmad Fatoum wrote:
> The driver readily works in 32-bit mode as it takes care there
> to write zero to the DMA_DESC_ADDRESS_HI field of descriptors.
> In the receive path, a 32-bit integer is shifted by 32 though
> leading to a (harmless) warning. Adjust the type to silence it.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  drivers/net/bcmgenet.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/net/bcmgenet.c b/drivers/net/bcmgenet.c
> index 32ec36eff65a..3ae341a658a0 100644
> --- a/drivers/net/bcmgenet.c
> +++ b/drivers/net/bcmgenet.c
> @@ -314,8 +314,8 @@ static int bcmgenet_gmac_eth_recv(struct eth_device *edev)
>  	struct bcmgenet_eth_priv *priv = edev->priv;
>  	void *desc_base = priv->mac_reg + GENET_RX_OFF + priv->rx_index * DMA_DESC_SIZE;
>  	u32 prod_index = readl(priv->mac_reg + RDMA_PROD_INDEX);
> -	u32 length;
> -	unsigned long addr_lo, addr_hi, addr;
> +	u32 length, addr_lo, addr_hi;
> +	dma_addr_t addr;
>  
>  	if (prod_index == priv->c_index)
>  		return -EAGAIN;
> @@ -324,7 +324,7 @@ static int bcmgenet_gmac_eth_recv(struct eth_device *edev)
>  	length = (length >> DMA_BUFLENGTH_SHIFT) & DMA_BUFLENGTH_MASK;
>  	addr_lo = readl(desc_base + DMA_DESC_ADDRESS_LO);
>  	addr_hi = readl(desc_base + DMA_DESC_ADDRESS_HI);
> -	addr = addr_hi << 32 | addr_lo;
> +	addr = (u64)addr_hi << 32 | addr_lo;
>  
>  	dma_sync_single_for_cpu(addr, length, DMA_FROM_DEVICE);
>  
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list