public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/staging/vt6655/iwctl.c fix a sparse warning
@ 2014-03-26  7:42 Jimmy Li
  2014-03-26 12:10 ` Greg Kroah-Hartman
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jimmy Li @ 2014-03-26  7:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Teodora Baluta, Peter P Waskiewicz Jr,
	Michael Gunselmann, Lisa Nguyen, Martin Hofmann,
	Malcolm Priestley, Tülin İzer, Archana kumari
  Cc: devel, linux-kernel

fix a sparse warning.
drivers/staging/vt6655/iwctl.c:1846:35: warning: cast from restricted
gfp_t
drivers/staging/vt6655/iwctl.c:1846:35: warning: incorrect type in
argument 2 (different base types)
drivers/staging/vt6655/iwctl.c:1846:35:    expected restricted gfp_t
[usertype] flags
drivers/staging/vt6655/iwctl.c:1846:35:    got int [signed] <noident>

Signed-off-by: Jimmy Li <coder.liss@gmail.com>
---
 drivers/staging/vt6655/iwctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
index ac3fc16..5e25535 100644
--- a/drivers/staging/vt6655/iwctl.c
+++ b/drivers/staging/vt6655/iwctl.c
@@ -1843,7 +1843,7 @@ int iwctl_siwencodeext(struct net_device *dev,
 	PRINT_K("SIOCSIWENCODEEXT...... \n");
 
 	blen = sizeof(*param);
-	buf = kmalloc((int)blen, (int)GFP_KERNEL);
+	buf = kmalloc((int)blen, GFP_KERNEL);
 	if (buf == NULL)
 		return -ENOMEM;
 	memset(buf, 0, blen);
-- 
1.7.10.4


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

* Re: [PATCH] drivers/staging/vt6655/iwctl.c fix a sparse warning
  2014-03-26  7:42 [PATCH] drivers/staging/vt6655/iwctl.c fix a sparse warning Jimmy Li
@ 2014-03-26 12:10 ` Greg Kroah-Hartman
  2014-03-26 15:16 ` Joe Perches
  2014-03-28  3:28 ` Jimmy Li
  2 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2014-03-26 12:10 UTC (permalink / raw)
  To: Jimmy Li
  Cc: Teodora Baluta, Peter P Waskiewicz Jr, Michael Gunselmann,
	Lisa Nguyen, Martin Hofmann, Malcolm Priestley,
	Tülin İzer, Archana kumari, devel, linux-kernel

On Wed, Mar 26, 2014 at 12:42:43AM -0700, Jimmy Li wrote:
> fix a sparse warning.
> drivers/staging/vt6655/iwctl.c:1846:35: warning: cast from restricted
> gfp_t
> drivers/staging/vt6655/iwctl.c:1846:35: warning: incorrect type in
> argument 2 (different base types)
> drivers/staging/vt6655/iwctl.c:1846:35:    expected restricted gfp_t
> [usertype] flags
> drivers/staging/vt6655/iwctl.c:1846:35:    got int [signed] <noident>

In the future, please don't line-wrap error/warning messages like this.

> 
> Signed-off-by: Jimmy Li <coder.liss@gmail.com>
> ---
>  drivers/staging/vt6655/iwctl.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
> index ac3fc16..5e25535 100644
> --- a/drivers/staging/vt6655/iwctl.c
> +++ b/drivers/staging/vt6655/iwctl.c
> @@ -1843,7 +1843,7 @@ int iwctl_siwencodeext(struct net_device *dev,
>  	PRINT_K("SIOCSIWENCODEEXT...... \n");
>  
>  	blen = sizeof(*param);
> -	buf = kmalloc((int)blen, (int)GFP_KERNEL);
> +	buf = kmalloc((int)blen, GFP_KERNEL);
>  	if (buf == NULL)
>  		return -ENOMEM;
>  	memset(buf, 0, blen);
> -- 
> 1.7.10.4

Thanks, I'll queue this up after 3.15-rc1 is out, as my tree is
currently closed.

greg k-h

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

* Re: [PATCH] drivers/staging/vt6655/iwctl.c fix a sparse warning
  2014-03-26  7:42 [PATCH] drivers/staging/vt6655/iwctl.c fix a sparse warning Jimmy Li
  2014-03-26 12:10 ` Greg Kroah-Hartman
@ 2014-03-26 15:16 ` Joe Perches
  2014-03-28  3:28 ` Jimmy Li
  2 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2014-03-26 15:16 UTC (permalink / raw)
  To: Jimmy Li
  Cc: Greg Kroah-Hartman, Teodora Baluta, Peter P Waskiewicz Jr,
	Michael Gunselmann, Lisa Nguyen, Martin Hofmann,
	Malcolm Priestley, Tülin İzer, Archana kumari, devel,
	linux-kernel

On Wed, 2014-03-26 at 00:42 -0700, Jimmy Li wrote:
> fix a sparse warning.
[]
> diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
[]
> @@ -1843,7 +1843,7 @@ int iwctl_siwencodeext(struct net_device *dev,
[]
>  	blen = sizeof(*param);
> -	buf = kmalloc((int)blen, (int)GFP_KERNEL);
> +	buf = kmalloc((int)blen, GFP_KERNEL);
>  	if (buf == NULL)
>  		return -ENOMEM;
>  	memset(buf, 0, blen);

Ideally, this would be

	buf = kzalloc(sizeof(*param), GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

removing the now unused blen variable declaration
and without the now unnecessary memset



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

* Re: [PATCH] drivers/staging/vt6655/iwctl.c fix a sparse warning
  2014-03-26  7:42 [PATCH] drivers/staging/vt6655/iwctl.c fix a sparse warning Jimmy Li
  2014-03-26 12:10 ` Greg Kroah-Hartman
  2014-03-26 15:16 ` Joe Perches
@ 2014-03-28  3:28 ` Jimmy Li
  2014-04-03  9:04   ` Dan Carpenter
  2 siblings, 1 reply; 5+ messages in thread
From: Jimmy Li @ 2014-03-28  3:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Teodora Baluta, Peter P Waskiewicz Jr,
	Michael Gunselmann, Lisa Nguyen, Martin Hofmann,
	Malcolm Priestley, Tülin İzer, Archana kumari
  Cc: devel, linux-kernel

On Wed, Mar 26, 2014 at 12:42:43AM -0700, Jimmy Li wrote:
> fix a sparse warning.
> drivers/staging/vt6655/iwctl.c:1846:35: warning: cast from restricted
> gfp_t
> drivers/staging/vt6655/iwctl.c:1846:35: warning: incorrect type in
> argument 2 (different base types)
> drivers/staging/vt6655/iwctl.c:1846:35:    expected restricted gfp_t
> [usertype] flags
> drivers/staging/vt6655/iwctl.c:1846:35:    got int [signed] <noident>
> 
> Signed-off-by: Jimmy Li <coder.liss@gmail.com>
> ---
>  drivers/staging/vt6655/iwctl.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
> index ac3fc16..5e25535 100644
> --- a/drivers/staging/vt6655/iwctl.c
> +++ b/drivers/staging/vt6655/iwctl.c
> @@ -1843,7 +1843,7 @@ int iwctl_siwencodeext(struct net_device *dev,
>  	PRINT_K("SIOCSIWENCODEEXT...... \n");
>  
>  	blen = sizeof(*param);
> -	buf = kmalloc((int)blen, (int)GFP_KERNEL);
> +	buf = kmalloc((int)blen, GFP_KERNEL);
>  	if (buf == NULL)
>  		return -ENOMEM;
>  	memset(buf, 0, blen);
> -- 
> 1.7.10.4
> 

You are right, I found that variable buf also don't make sense here,
maybe this could be more clear.

    param = kzalloc(sizeof(struct viawget_wpa_param), GFP_KERNEL);
    if (param == NULL)
        return -ENOMEM;

removing two unnecessary variable, buf and blen.

In this situation, I should send a new patch v2 for it base on the
previous path? or send a new patch include all changes?

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

* Re: [PATCH] drivers/staging/vt6655/iwctl.c fix a sparse warning
  2014-03-28  3:28 ` Jimmy Li
@ 2014-04-03  9:04   ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2014-04-03  9:04 UTC (permalink / raw)
  To: Jimmy Li
  Cc: Greg Kroah-Hartman, Teodora Baluta, Peter P Waskiewicz Jr,
	Michael Gunselmann, Lisa Nguyen, Martin Hofmann,
	Malcolm Priestley, Tülin İzer, Archana kumari, devel,
	linux-kernel

On Thu, Mar 27, 2014 at 08:28:44PM -0700, Jimmy Li wrote:
> You are right, I found that variable buf also don't make sense here,
> maybe this could be more clear.
> 
>     param = kzalloc(sizeof(struct viawget_wpa_param), GFP_KERNEL);
>     if (param == NULL)
>         return -ENOMEM;
> 
> removing two unnecessary variable, buf and blen.
> 
> In this situation, I should send a new patch v2 for it base on the
> previous path? or send a new patch include all changes?

We throw away the original patch and you send a v2.  Use the subject:

[PATCH v2] drivers/staging/vt6655/iwctl.c fix a sparse warning

Under the Signed-off-by line put:
Signed-off-by: you
---
v2: additional cleanups as well.

regards,
dan carpenter


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

end of thread, other threads:[~2014-04-03  9:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-26  7:42 [PATCH] drivers/staging/vt6655/iwctl.c fix a sparse warning Jimmy Li
2014-03-26 12:10 ` Greg Kroah-Hartman
2014-03-26 15:16 ` Joe Perches
2014-03-28  3:28 ` Jimmy Li
2014-04-03  9:04   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox