hostap:hostap_ioctl.c Fix variable 'ret' set but not used
PATCH v3 1/1 hostap:hostap_ioctl.c Fix variable 'ret' set but not used
Resend version 3
The below patch fixes a warning message generated by GCC:
CC [M] drivers/net/wireless/hostap/hostap_ioctl.odrivers/net/wireless/hostap/hostap_ioctl.c: In function 'prism2_request_scan':drivers/net/wireless/hostap/hostap_ioctl.c:1666:6: warning: variable 'ret' set but not used
--- drivers/net/wireless/hostap/hostap_ioctl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/hostap/hostap_ioctl.c +1 -1
@@ -1689,7 +1689,7 @@ static int prism2_request_scan(struct net_device *dev)if (local->func->set_rid (dev,HFA384X_RID_SCANREQUEST , &scan_req,sizeof (scan_req))) {printk (KERN_DEBUG "SCANREQUEST failed\n" ); - ret = -EINVAL ; +return ret; }if (!local->host_roaming)
Signature · 1 line
1.7.1.rc1.21.gf3bd6
Julian Calaby
NAKQuoted 18 lines · Justin P. Mattock
Resend version 3
The below patch fixes a warning message generated by GCC:
CC [M] drivers/net/wireless/hostap/hostap_ioctl.odrivers/net/wireless/hostap/hostap_ioctl.c: In function 'prism2_request_scan':drivers/net/wireless/hostap/hostap_ioctl.c:1666:6: warning: variable 'ret' set but not usedSigned-off-by Justin P. Mattock <[email protected]>---
drivers/net/wireless/hostap/hostap_ioctl.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/net/wireless/hostap/hostap_ioctl.c +0
-0
drivers/net/wireless/hostap/hostap_ioctl.c static int prism2_request_scan(struct net_device *dev) · line 1695
Quoted 8 lines
drivers/net/wireless/hostap/hostap_ioctl.c +1
-1@@ -1689,7 +1689,7 @@ static int prism2_request_scan(struct net_device *dev) if (local->func->set_rid(dev, HFA384X_RID_SCANREQUEST, &scan_req, sizeof(scan_req))) { printk(KERN_DEBUG "SCANREQUEST failed\n"); - ret = -EINVAL; + return ret; } if (!local->host_roaming)
NACK: This doesn't actually fix the error mentioned.
Attached is a more correct patch.
Apologies for the attachment, I'm building the patch by hand at work and only have gMail to send it with.
This should apply to wireless-testing.
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] .Plan: http://sites.google.com/site/juliancalaby/
Hostap: Fix "'ret' set but not used" warning message from GCC in hostap
CC [M] drivers/net/wireless/hostap/hostap_ioctl.odrivers/net/wireless/hostap/hostap_ioctl.c: In function 'prism2_request_scan':drivers/net/wireless/hostap/hostap_ioctl.c:1666:6: warning: variable 'ret' set but not used
---
drivers/net/wireless/hostap/hostap_ioctl.c +1 -1
@@ -1696,7 +1696,7 @@hostap_set_word (dev,HFA384X_RID_CNFROAMINGMODE ,HFA384X_ROAMING_FIRMWARE ); - return 0; + return ret; }#else /* !PRISM2_NO_STATION_MODES */
Quoted 30 lines · Julian Calaby
Quoted 18 lines · Justin P. Mattock
Resend version 3
The below patch fixes a warning message generated by GCC:
CC [M]drivers/net/wireless/hostap/hostap_ioctl.odrivers/net/wireless/hostap/hostap_ioctl.c: In function 'prism2_request_scan':drivers/net/wireless/hostap/hostap_ioctl.c:1666:6: warning: variable 'ret' set but not usedSigned-off-by Justin P. Mattock<[email protected]>--- drivers/net/wireless/hostap/hostap_ioctl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/net/wireless/hostap/hostap_ioctl.c +0
-0drivers/net/wireless/hostap/hostap_ioctl.c static int prism2_request_scan(struct net_device *dev) · line 1695
Quoted 8 lines
drivers/net/wireless/hostap/hostap_ioctl.c +1
-1@@ -1689,7 +1689,7 @@ static int prism2_request_scan(struct net_device *dev)if (local->func->set_rid (dev,HFA384X_RID_SCANREQUEST ,&scan_req,sizeof (scan_req))) {printk (KERN_DEBUG "SCANREQUEST failed\n" ); - ret = -EINVAL ; +return ret; }if (!local->host_roaming)NACK: This doesn't actually fix the error mentioned.
Quoted 9 lines
Attached is a more correct patch.
Apologies for the attachment, I'm building the patch by hand at work and only have gMail to send it with.
This should apply to wireless-testing.
Thanks,
wait im lost.. looking at your patch looks the same(number wise) except I see different parts of code in there:
hostap_set_word(dev, HFA384X_RID_CNFROAMINGMODE,
HFA384X_ROAMING_FIRMWARE);
- return 0;
+ return ret;
mine is:
printk(KERN_DEBUG "SCANREQUEST failed\n");
- ret = -EINVAL;
+ return ret;
The tree Im using is Linus's tree.
any ideas?
Justin P. Mattock
Quoted 11 lines · Justin P. Mattock
wait im lost.. looking at your patch looks the same(number wise) except I see different parts of code in there:
hostap_set_word(dev, HFA384X_RID_CNFROAMINGMODE, HFA384X_ROAMING_FIRMWARE);- return 0;
+ return ret;
Quoted 8 lines
mine is:
printk(KERN_DEBUG "SCANREQUEST failed\n");
- ret =-EINVAL;
+ return ret;The tree Im using is Linus's tree.
I'm using wireless-testing, and the line you're changing is #1692, I'm changing #1699.
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] .Plan: http://sites.google.com/site/juliancalaby/
Quoted 19 lines · Julian Calaby
Quoted 18 lines · Justin P. Mattock
wait im lost.. looking at your patch looks the same(number wise) except I see different parts of code in there:
hostap_set_word(dev,
HFA384X_RID_CNFROAMINGMODE,HFA384X_ROAMING_FIRMWARE);drivers/net/wireless/hostap/hostap_ioctl.c +1
-1-return 0 ; +return ret;mine is:
printk(KERN_DEBUG "SCANREQUEST failed\n");(quoted diff) +1
-1- ret = -EINVAL; + return ret;
Quoted 7 lines
Quoted 1 line
The tree Im using is Linus's tree.
I'm using wireless-testing, and the line you're changing is #1692, I'm changing #1699.
Thanks,
ahh.. so there's two return ret's that need to be added then..
(if so then go ahead and take my patch and add it to yours.. I'm off to other things)
cheers,
Justin P. Mattock
Quoted 28 lines · Justin P. Mattock
Quoted 27 lines · Julian Calaby
Quoted 12 lines · Justin P. Mattock
wait im lost.. looking at your patch looks the same(number wise) except I see different parts of code in there:
hostap_set_word(dev, HFA384X_RID_CNFROAMINGMODE, HFA384X_ROAMING_FIRMWARE);- return 0;
+ return ret;Quoted 8 lines
mine is:
printk(KERN_DEBUG "SCANREQUEST failed\n");
- ret =-EINVAL;
+ return ret;The tree Im using is Linus's tree.
I'm using wireless-testing, and the line you're changing is #1692, I'm changing #1699.
Quoted 7 lines
Quoted 2 lines
Thanks,
ahh.. so there's two return ret's that need to be added then.. (if so then go ahead and take my patch and add it to yours.. I'm off to other things)
No.
The function works like this:
1. set up scan_req
2. if local->host_roaming is not set, set host roaming on the hardware
3. set scan_req on the hardware
4. if local->host_roaming is not set, set the hardware to do firmware roaming
5. If set_req could not be set on the hardware, return -EINVAL, otherwise return 0.
The significant bits are steps 2 and 4. These must *both* be executed, regardless of whether setting scan_req on the hardware succeeds or not.
As such, the return value is stored in the ret variable, which is initialised to 0 initially, then set to -EINVAL if setting scan_req on the hardware fails. Hence, step 5 can be performed by returning ret.
As such, all of your patches are wrong as they are either returning the wrong value when setting scan_req on the hardware fails, or failing to execute step 4. The *only* correct place to return a value is once the roaming status of the hardware has been set properly - i.e. at the end of the function.
I hope this has cleared up your confusion.
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] .Plan: http://sites.google.com/site/juliancalaby/
Quoted 62 lines · Julian Calaby
Quoted 28 lines · Justin P. Mattock
Quoted 27 lines · Julian Calaby
Quoted 19 lines · Justin P. Mattock
wait im lost.. looking at your patch looks the same(number wise) except I see different parts of code in there:
hostap_set_word(dev,
HFA384X_RID_CNFROAMINGMODE,HFA384X_ROAMING_FIRMWARE);drivers/net/wireless/hostap/hostap_ioctl.c +1
-1-return 0 ; +return ret;mine is:
printk(KERN_DEBUG "SCANREQUEST failed\n");(quoted diff) +1
-1- ret = -EINVAL; + return ret;Quoted 1 line
The tree Im using is Linus's tree.
I'm using wireless-testing, and the line you're changing is #1692, I'm changing #1699.
Quoted 7 lines
Quoted 2 lines
Thanks,
ahh.. so there's two return ret's that need to be added then.. (if so then go ahead and take my patch and add it to yours.. I'm off to other things)
No.
The function works like this:
1. set up
scan_req
2. iflocal->host_roamingis not set, set host roaming on the hardware
3. setscan_reqon the hardware
4. iflocal->host_roamingis not set, set the hardware to do firmware roaming
5. Ifset_reqcould not be set on the hardware, return-EINVAL, otherwise return 0.The significant bits are steps 2 and 4. These must *both* be executed, regardless of whether setting
scan_reqon the hardware succeeds or not.As such, the return value is stored in the ret variable, which is initialised to 0 initially, then set to
-EINVALif settingscan_reqon the hardware fails. Hence, step 5 can be performed by returning ret.As such, all of your patches are wrong as they are either returning the wrong value when setting
scan_reqon the hardware fails, or failing to execute step 4. The *only* correct place to return a value is once the roaming status of the hardware has been set properly - i.e. at the end of the function.
Quoted 4 lines
I hope this has cleared up your confusion.
Thanks,
cleared it up perfectly... didnt think that using ret down more would work..(was stuck a few lines up) but it does.. just tested your version out and no warning messages..
cheers,
Justin P. Mattock