Re: [PATCH]hostap:hostap_ioctl.c Fix variable 'ret' set but not used

From: Luis R. Rodriguez
Date: Mon Aug 02 2010 - 20:16:59 EST


On Mon, Aug 2, 2010 at 5:15 PM, Luis R. Rodriguez <mcgrof@xxxxxxxxx> wrote:
> On Mon, Aug 2, 2010 at 5:04 PM, Justin P. Mattock
> <justinmattock@xxxxxxxxx> wrote:
>> The below patch fixes a warning message generated by GCC:
>> ÂCC [M] Âdrivers/net/wireless/hostap/hostap_ioctl.o
>> drivers/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
>>
>> Keep in mind Im not sure if this is the right fix for this, so please
>> feedback is appreciated.
>>
>> Signed-off-by: Justin P. Mattock <justinmattock@xxxxxxxxx>
>>
>> ---
>> Âdrivers/net/wireless/hostap/hostap_ioctl.c | Â Â3 +--
>> Â1 files changed, 1 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
>> index a85e43a..27d462f 100644
>> --- a/drivers/net/wireless/hostap/hostap_ioctl.c
>> +++ b/drivers/net/wireless/hostap/hostap_ioctl.c
>> @@ -1663,7 +1663,6 @@ static int prism2_request_scan(struct net_device *dev)
>> Â Â Â Âstruct hostap_interface *iface;
>> Â Â Â Âlocal_info_t *local;
>> Â Â Â Âstruct hfa384x_scan_request scan_req;
>> - Â Â Â int ret = 0;
>>
>> Â Â Â Âiface = netdev_priv(dev);
>> Â Â Â Âlocal = iface->local;
>> @@ -1689,7 +1688,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 -EINVAL;
>> Â Â Â Â}
>>
>> Â Â Â Âif (!local->host_roaming)
>
> NACK please read the code instead of just patching blindly to cure a
> compile issue. For example read this big block:
>
>
> Â Â Â Â/* FIX:
> Â Â Â Â * It seems to be enough to set roaming mode for a short moment to
> Â Â Â Â * host-based and then setup scanrequest data and return the mode to
> Â Â Â Â * firmware-based.
> Â Â Â Â *
> Â Â Â Â * Master mode would need to drop to Managed mode for a short while
> Â Â Â Â * to make scanning work.. Or sweep through the different channels and
> Â Â Â Â * use passive scan based on beacons. */
>
> So.. it seems to me you likely want to flip back to
> HFA384X_ROAMING_FIRMWARE *after* you've tried to issue the
> HFA384X_RID_SCANREQUEST, even if it has failed. So the compile fix
> should require just changing the last return statement of the function
> to return ret value.

And for 802.11 there is no need to cc netdev and lkml. Just use linux-wireless.

Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/