diff mbox

[24/28] staging: wilc1000: fix cast from pointer to integer warning

Message ID 1438328316-30197-25-git-send-email-tony.cho@atmel.com (mailing list archive)
State Not Applicable
Delegated to: Kalle Valo
Headers show

Commit Message

Tony Cho July 31, 2015, 7:38 a.m. UTC
From: glen lee <glen.lee@atmel.com>

To use a pointer as as integer in arithmetic operation, cast type to uintptr_t
as the data type.
This patch changes casting (unsigned int) with (uintptr_t) to do arithmetic operation

Here is build warning.
drivers/staging/wilc1000/linux_wlan.c:2385:20: warning: cast from pointer to
integer of different size [-Wpointer-to-int-cast]
   skb_reserve(skb, (unsigned int)skb->data & 0x3);

Signed-off-by: glen lee <glen.lee@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Greg KH July 31, 2015, 8:51 p.m. UTC | #1
On Fri, Jul 31, 2015 at 04:38:32PM +0900, Tony Cho wrote:
> From: glen lee <glen.lee@atmel.com>
> 
> To use a pointer as as integer in arithmetic operation, cast type to uintptr_t
> as the data type.
> This patch changes casting (unsigned int) with (uintptr_t) to do arithmetic operation
> 
> Here is build warning.
> drivers/staging/wilc1000/linux_wlan.c:2385:20: warning: cast from pointer to
> integer of different size [-Wpointer-to-int-cast]
>    skb_reserve(skb, (unsigned int)skb->data & 0x3);
> 
> Signed-off-by: glen lee <glen.lee@atmel.com>
> Signed-off-by: Tony Cho <tony.cho@atmel.com>
> ---
>  drivers/staging/wilc1000/linux_wlan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
> index 5dcb30c..ec80849 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -2382,7 +2382,7 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset)
>  			return;
>  		}
>  
> -		skb_reserve(skb, (unsigned int)skb->data & 0x3);
> +		skb_reserve(skb, (uintptr_t)skb->data & 0x3);

Why is a cast needed at all here?

And again, don't use uintptr_t, it is not a kernel type.

I've stopped reviewing here, sorry, please fix up the series and resend.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 5dcb30c..ec80849 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -2382,7 +2382,7 @@  void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset)
 			return;
 		}
 
-		skb_reserve(skb, (unsigned int)skb->data & 0x3);
+		skb_reserve(skb, (uintptr_t)skb->data & 0x3);
 
 		if (g_linux_wlan == NULL || wilc_netdev == NULL)
 			PRINT_ER("wilc_netdev in g_linux_wlan is NULL");