All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] sfc: fix build warnings on 32-bit
@ 2020-08-20 10:47 Edward Cree
  2020-08-20 14:14 ` Randy Dunlap
  2020-08-20 19:01 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Edward Cree @ 2020-08-20 10:47 UTC (permalink / raw)
  To: linux-net-drivers, davem; +Cc: netdev, rdunlap

Truncation of DMA_BIT_MASK to 32-bit dma_addr_t is semantically safe,
 but the compiler was warning because it was happening implicitly.
Insert explicit casts to suppress the warnings.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Edward Cree <ecree@solarflare.com>
---
 drivers/net/ethernet/sfc/ef100.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
index 9729983f4840..c54b7f8243f3 100644
--- a/drivers/net/ethernet/sfc/ef100.c
+++ b/drivers/net/ethernet/sfc/ef100.c
@@ -142,7 +142,7 @@ static int ef100_pci_parse_continue_entry(struct efx_nic *efx, int entry_locatio
 
 		/* Temporarily map new BAR. */
 		rc = efx_init_io(efx, bar,
-				 DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
+				 (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
 				 pci_resource_len(efx->pci_dev, bar));
 		if (rc) {
 			netif_err(efx, probe, efx->net_dev,
@@ -160,7 +160,7 @@ static int ef100_pci_parse_continue_entry(struct efx_nic *efx, int entry_locatio
 
 		/* Put old BAR back. */
 		rc = efx_init_io(efx, previous_bar,
-				 DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
+				 (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
 				 pci_resource_len(efx->pci_dev, previous_bar));
 		if (rc) {
 			netif_err(efx, probe, efx->net_dev,
@@ -334,7 +334,7 @@ static int ef100_pci_parse_xilinx_cap(struct efx_nic *efx, int vndr_cap,
 
 	/* Temporarily map BAR. */
 	rc = efx_init_io(efx, bar,
-			 DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
+			 (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
 			 pci_resource_len(efx->pci_dev, bar));
 	if (rc) {
 		netif_err(efx, probe, efx->net_dev,
@@ -495,7 +495,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
 
 	/* Set up basic I/O (BAR mappings etc) */
 	rc = efx_init_io(efx, fcw.bar,
-			 DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
+			 (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
 			 pci_resource_len(efx->pci_dev, fcw.bar));
 	if (rc)
 		goto fail;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] sfc: fix build warnings on 32-bit
  2020-08-20 10:47 [PATCH net] sfc: fix build warnings on 32-bit Edward Cree
@ 2020-08-20 14:14 ` Randy Dunlap
  2020-08-20 19:01 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2020-08-20 14:14 UTC (permalink / raw)
  To: Edward Cree, linux-net-drivers, davem; +Cc: netdev

On 8/20/20 3:47 AM, Edward Cree wrote:
> Truncation of DMA_BIT_MASK to 32-bit dma_addr_t is semantically safe,
>  but the compiler was warning because it was happening implicitly.
> Insert explicit casts to suppress the warnings.
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Edward Cree <ecree@solarflare.com>

Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

> ---
>  drivers/net/ethernet/sfc/ef100.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
> index 9729983f4840..c54b7f8243f3 100644
> --- a/drivers/net/ethernet/sfc/ef100.c
> +++ b/drivers/net/ethernet/sfc/ef100.c
> @@ -142,7 +142,7 @@ static int ef100_pci_parse_continue_entry(struct efx_nic *efx, int entry_locatio
>  
>  		/* Temporarily map new BAR. */
>  		rc = efx_init_io(efx, bar,
> -				 DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
> +				 (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
>  				 pci_resource_len(efx->pci_dev, bar));
>  		if (rc) {
>  			netif_err(efx, probe, efx->net_dev,
> @@ -160,7 +160,7 @@ static int ef100_pci_parse_continue_entry(struct efx_nic *efx, int entry_locatio
>  
>  		/* Put old BAR back. */
>  		rc = efx_init_io(efx, previous_bar,
> -				 DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
> +				 (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
>  				 pci_resource_len(efx->pci_dev, previous_bar));
>  		if (rc) {
>  			netif_err(efx, probe, efx->net_dev,
> @@ -334,7 +334,7 @@ static int ef100_pci_parse_xilinx_cap(struct efx_nic *efx, int vndr_cap,
>  
>  	/* Temporarily map BAR. */
>  	rc = efx_init_io(efx, bar,
> -			 DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
> +			 (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
>  			 pci_resource_len(efx->pci_dev, bar));
>  	if (rc) {
>  		netif_err(efx, probe, efx->net_dev,
> @@ -495,7 +495,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
>  
>  	/* Set up basic I/O (BAR mappings etc) */
>  	rc = efx_init_io(efx, fcw.bar,
> -			 DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
> +			 (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
>  			 pci_resource_len(efx->pci_dev, fcw.bar));
>  	if (rc)
>  		goto fail;
> 


-- 
~Randy


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] sfc: fix build warnings on 32-bit
  2020-08-20 10:47 [PATCH net] sfc: fix build warnings on 32-bit Edward Cree
  2020-08-20 14:14 ` Randy Dunlap
@ 2020-08-20 19:01 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-08-20 19:01 UTC (permalink / raw)
  To: ecree; +Cc: linux-net-drivers, netdev, rdunlap

From: Edward Cree <ecree@solarflare.com>
Date: Thu, 20 Aug 2020 11:47:19 +0100

> Truncation of DMA_BIT_MASK to 32-bit dma_addr_t is semantically safe,
>  but the compiler was warning because it was happening implicitly.
> Insert explicit casts to suppress the warnings.
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Edward Cree <ecree@solarflare.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-20 19:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 10:47 [PATCH net] sfc: fix build warnings on 32-bit Edward Cree
2020-08-20 14:14 ` Randy Dunlap
2020-08-20 19:01 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.