diff options
author | Pavel Roskin <proski@gnu.org> | 2005-09-02 02:06:06 +0200 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-06 00:14:07 +0200 |
commit | c89cc225f72ec240196733872fa1a9eb9d8335ac (patch) | |
tree | 08d8d46b486a3517f94e1c3d9077dbb156dcbd73 /drivers | |
parent | [PATCH] orinoco: Fix memory leak on error in processing hostscan frames. (diff) | |
download | linux-c89cc225f72ec240196733872fa1a9eb9d8335ac.tar.xz linux-c89cc225f72ec240196733872fa1a9eb9d8335ac.zip |
[PATCH] orinoco: Optimize orinoco_join_ap()
Signed-off-by: Pavel Roskin <proski@gnu.org>
diff-tree cb289b9f9b2a0f3ae7070a008f22e383b37526ee (from 56bfcdb38b3d04c1f8c1fd705e411f4be53b663c)
Author: Pavel Roskin <proski@gnu.org>
Date: Thu Sep 1 19:05:16 2005 -0400
Optimize orinoco_join_ap() - break from loop once the requested
BSSID
is found.
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/orinoco.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 95eb05abc44a..8de49fe57233 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c @@ -1053,8 +1053,9 @@ static void orinoco_join_ap(struct net_device *dev) u16 channel; } __attribute__ ((packed)) req; const int atom_len = offsetof(struct prism2_scan_apinfo, atim); - struct prism2_scan_apinfo *atom; + struct prism2_scan_apinfo *atom = NULL; int offset = 4; + int found = 0; u8 *buf; u16 len; @@ -1089,15 +1090,18 @@ static void orinoco_join_ap(struct net_device *dev) * we were requested to join */ for (; offset + atom_len <= len; offset += atom_len) { atom = (struct prism2_scan_apinfo *) (buf + offset); - if (memcmp(&atom->bssid, priv->desired_bssid, ETH_ALEN) == 0) - goto found; + if (memcmp(&atom->bssid, priv->desired_bssid, ETH_ALEN) == 0) { + found = 1; + break; + } } - DEBUG(1, "%s: Requested AP not found in scan results\n", - dev->name); - goto out; + if (! found) { + DEBUG(1, "%s: Requested AP not found in scan results\n", + dev->name); + goto out; + } - found: memcpy(req.bssid, priv->desired_bssid, ETH_ALEN); req.channel = atom->channel; /* both are little-endian */ err = HERMES_WRITE_RECORD(hw, USER_BAP, HERMES_RID_CNFJOINREQUEST, |