[OPW,kernel] Staging: vt6656: Fix Sparse Warning: cast from restricted gfp_t in hostap.c
diff mbox

Message ID 1382647888-22120-1-git-send-email-ebru.akagunduz@gmail.com
State Changes Requested
Headers show

Commit Message

Ebru Akagündüz Oct. 24, 2013, 8:51 p.m. UTC
This patch fixes the following type of sparse warnings:

drivers/staging/vt6656/hostap.c:688:42: warning: cast from restricted gfp_t
drivers/staging/vt6656/hostap.c:688:42: warning: incorrect type in argument 2 (different base types)
drivers/staging/vt6656/hostap.c:688:42: expected restricted gfp_t [usertype] flags
drivers/staging/vt6656/hostap.c:688:42: got int [signed] <noident>

Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
---
 drivers/staging/vt6656/hostap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rusty Russell Oct. 25, 2013, 1:09 a.m. UTC | #1
Ebru Akagunduz <ebru.akagunduz@gmail.com> writes:
> This patch fixes the following type of sparse warnings:
>
> drivers/staging/vt6656/hostap.c:688:42: warning: cast from restricted gfp_t
> drivers/staging/vt6656/hostap.c:688:42: warning: incorrect type in argument 2 (different base types)
> drivers/staging/vt6656/hostap.c:688:42: expected restricted gfp_t [usertype] flags
> drivers/staging/vt6656/hostap.c:688:42: got int [signed] <noident>
>
> Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>

In fact, neither of these casts are necessary.  p->length is a u16.

Cheers,
Rusty.

> ---
>  drivers/staging/vt6656/hostap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
> index 7d96fe7..aace10d 100644
> --- a/drivers/staging/vt6656/hostap.c
> +++ b/drivers/staging/vt6656/hostap.c
> @@ -685,7 +685,7 @@ int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p)
>  	    p->length > VIAWGET_HOSTAPD_MAX_BUF_SIZE || !p->pointer)
>  		return -EINVAL;
>  
> -	param = kmalloc((int)p->length, (int)GFP_KERNEL);
> +	param = kmalloc((int)p->length, (gfp_t)GFP_KERNEL);
>  	if (param == NULL)
>  		return -ENOMEM;
>  
> -- 
> 1.8.1.2
>
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Patch
diff mbox

diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
index 7d96fe7..aace10d 100644
--- a/drivers/staging/vt6656/hostap.c
+++ b/drivers/staging/vt6656/hostap.c
@@ -685,7 +685,7 @@  int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p)
 	    p->length > VIAWGET_HOSTAPD_MAX_BUF_SIZE || !p->pointer)
 		return -EINVAL;
 
-	param = kmalloc((int)p->length, (int)GFP_KERNEL);
+	param = kmalloc((int)p->length, (gfp_t)GFP_KERNEL);
 	if (param == NULL)
 		return -ENOMEM;