2014-04-08 11:09:43

by Jimmy Li

[permalink] [raw]
Subject: [PATCH v3] Staging: vt6655: iwctl.c: fix a sparse warning

thanks for correcting my patch format.

Signed-off-by: Jimmy Li <[email protected]>
---
v1 fix a sparse warning.
(iwctl.c:1846:35: expected restricted gfp_t [usertype] flags)
v2 clear up two unnecessary variable, buf and blen.
v3 fix patch format.
drivers/staging/vt6655/iwctl.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
index ac3fc16..394031b 100644
--- a/drivers/staging/vt6655/iwctl.c
+++ b/drivers/staging/vt6655/iwctl.c
@@ -1835,19 +1835,14 @@ int iwctl_siwencodeext(struct net_device *dev,
size_t seq_len = 0, key_len = 0;
//
// int ii;
- u8 *buf;
- size_t blen;
u8 key_array[64];
int ret = 0;

PRINT_K("SIOCSIWENCODEEXT...... \n");

- blen = sizeof(*param);
- buf = kmalloc((int)blen, (int)GFP_KERNEL);
- if (buf == NULL)
+ param = kzalloc(sizeof(struct viawget_wpa_param), GFP_KERNEL);
+ if (param == NULL)
return -ENOMEM;
- memset(buf, 0, blen);
- param = (struct viawget_wpa_param *)buf;

//recover alg_name
switch (ext->alg) {
--
1.7.9.5


2014-04-08 11:20:04

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v3] Staging: vt6655: iwctl.c: fix a sparse warning

On Tue, Apr 08, 2014 at 07:09:27PM +0800, Jimmy Li wrote:
> thanks for correcting my patch format.
>
> Signed-off-by: Jimmy Li <[email protected]>
> ---
> v1 fix a sparse warning.
> (iwctl.c:1846:35: expected restricted gfp_t [usertype] flags)
> v2 clear up two unnecessary variable, buf and blen.
> v3 fix patch format.
> drivers/staging/vt6655/iwctl.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)

Please try applying your patch. Save the email as raw text including
headers and everything. `cat raw_email.txt | git am`. Then review the
log with `git log`. You'll see that the format is still messed up. :(

The part which should be discarded is saved and the part which should be
saved is deleted.

regards,
dan carpenter

2014-04-08 12:45:10

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH v4] Staging: vt6655: iwctl.c: fix a sparse warning

On Tue, 2014-04-08 at 20:36 +0800, Jimmy Li wrote:
> fix a sparse warning and do some clean up.
>
> Signed-off-by: Jimmy Li <[email protected]>

The --- line should go here

> v1 fix a sparse warning.
> (iwctl.c:1846:35: expected restricted gfp_t [usertype] flags)
> v2 clear up two unnecessary variable, buf and blen.
> v3 fix patch format.
> v4 fix patch format again.
>
> ---

not here

As is, the versioning information would end up
in the changlog and that isn't the desired style.

> diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
[]
> @@ -1835,19 +1835,14 @@ int iwctl_siwencodeext(struct net_device *dev,
[]
> + param = kzalloc(sizeof(struct viawget_wpa_param), GFP_KERNEL);

Also, param is a struct viawget_wpa_param * so
this should use:

param = kzalloc(sizeof(*param), GFP_KERNEL);

2014-04-08 14:26:46

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v5] Staging: vt6655: iwctl.c: fix a sparse warning

On Tue, Apr 08, 2014 at 09:35:02PM +0800, Jimmy Li wrote:
> fix a sparse warning and do some clean up.
> iwctl.c:1846:35: expected restricted gfp_t [usertype] flags
>
> Signed-off-by: Jimmy Li <[email protected]>
> ---

Looks good.

regards,
dan carpenter