Skip to contentSkip to conversation

Staging: vt6655: iwctl.c: fix a sparse warning

PATCH In review Jimmy Li 3 participants 4 messages Apr 8, 2014 Staging

lore
Share & tools
lore

Jimmy Li

author
#0 lore raw

PATCH v3 1/1 Staging: vt6655: iwctl.c: fix a sparse warning

thanks for correcting my patch format.

---
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(-)
drivers/staging/vt6655/iwctl.c +2 -7
index ac3fc16..394031b 100644
@@ -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) {
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 10 lines · Jimmy Li

thanks for correcting my patch format.

---
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

#2 lore raw
In reply to Jimmy Li
Quoted 3 lines · Jimmy Li

fix a sparse warning and do some clean up.

The --- line should go here

Quoted 7 lines

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.

drivers/staging/vt6655/iwctl.c

Quoted 1 line
drivers/staging/vt6655/iwctl.c +0 -0

[]

drivers/staging/vt6655/iwctl.c int iwctl_siwencodeext(struct net_device *dev,

Quoted 1 line
drivers/staging/vt6655/iwctl.c +0 -0
@@ -1835,19 +1835,14 @@ int iwctl_siwencodeext(struct net_device *dev,

[]

drivers/staging/vt6655/iwctl.c int iwctl_siwencodeext(struct net_device *dev, · line 1843

Quoted 1 line
drivers/staging/vt6655/iwctl.c +1 -0
+	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);