drivers/staging/vt6655/iwctl.c fix a sparse warning
PATCH 1/1 drivers/staging/vt6655/iwctl.c fix a sparse warning
fix a sparse warning. drivers/staging/vt6655/iwctl.c:1846:35: warning: cast from restricted gfp_tdrivers/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] flagsdrivers/staging/vt6655/iwctl.c:1846:35: got int [signed] <noident>
--- drivers/staging/vt6655/iwctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/iwctl.c +1 -1
@@ -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);
Signature · 1 line
1.7.10.4
Greg Kroah-Hartman
maintainerQuoted 8 lines · Jimmy Li
fix a sparse warning.
drivers/staging/vt6655/iwctl.c:1846:35: warning: cast from restrictedgfp_tdrivers/staging/vt6655/iwctl.c:1846:35: warning: incorrect type in argument 2 (different base types)drivers/staging/vt6655/iwctl.c:1846:35: expected restrictedgfp_t
[usertype] flagsdrivers/staging/vt6655/iwctl.c:1846:35: got int [signed] <noident>
In the future, please don't line-wrap error/warning messages like this.
Quoted 21 lines
Signed-off-by Jimmy Li <[email protected]>--- drivers/staging/vt6655/iwctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/vt6655/iwctl.c +1
-1@@ -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);Signature · 1 line
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
Quoted 1 line · Jimmy Li
fix a sparse warning.
[]
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@@ -1843,7 +1843,7 @@ int iwctl_siwencodeext(struct net_device *dev,
[]
drivers/staging/vt6655/iwctl.c int iwctl_siwencodeext(struct net_device *dev, · line 1849
Quoted 6 lines
drivers/staging/vt6655/iwctl.c +1
-1blen =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
Quoted 30 lines · Jimmy Li
fix a sparse warning.
drivers/staging/vt6655/iwctl.c:1846:35: warning: cast from restrictedgfp_tdrivers/staging/vt6655/iwctl.c:1846:35: warning: incorrect type in argument 2 (different base types)drivers/staging/vt6655/iwctl.c:1846:35: expected restrictedgfp_t
[usertype] flagsdrivers/staging/vt6655/iwctl.c:1846:35: got int [signed] <noident>Signed-off-by Jimmy Li <[email protected]>--- drivers/staging/vt6655/iwctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/vt6655/iwctl.c +1
-1@@ -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);Signature · 1 line
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?
Quoted 11 lines · Jimmy Li
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