Commit 59334c2f authored by Jason Cooper's avatar Jason Cooper Committed by Greg Kroah-Hartman

staging: brcm80211: fix checkpatch error 'assignment in if condition'

Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
Acked-by: default avatarHenry Ptasinski <henryp@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9b890325
...@@ -342,7 +342,8 @@ wl_iw_config_commit(struct net_device *dev, ...@@ -342,7 +342,8 @@ wl_iw_config_commit(struct net_device *dev,
WL_TRACE(("%s: SIOCSIWCOMMIT\n", dev->name)); WL_TRACE(("%s: SIOCSIWCOMMIT\n", dev->name));
if ((error = dev_wlc_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid)))) error = dev_wlc_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid));
if (error)
return error; return error;
ssid.SSID_len = dtoh32(ssid.SSID_len); ssid.SSID_len = dtoh32(ssid.SSID_len);
...@@ -351,7 +352,8 @@ wl_iw_config_commit(struct net_device *dev, ...@@ -351,7 +352,8 @@ wl_iw_config_commit(struct net_device *dev,
return 0; return 0;
bzero(&bssid, sizeof(struct sockaddr)); bzero(&bssid, sizeof(struct sockaddr));
if ((error = dev_wlc_ioctl(dev, WLC_REASSOC, &bssid, ETHER_ADDR_LEN))) { error = dev_wlc_ioctl(dev, WLC_REASSOC, &bssid, ETHER_ADDR_LEN);
if (error) {
WL_ERROR(("%s: WLC_REASSOC to %s failed \n", __func__, WL_ERROR(("%s: WLC_REASSOC to %s failed \n", __func__,
ssid.SSID)); ssid.SSID));
return error; return error;
...@@ -398,7 +400,8 @@ wl_iw_set_freq(struct net_device *dev, ...@@ -398,7 +400,8 @@ wl_iw_set_freq(struct net_device *dev,
} }
chan = htod32(chan); chan = htod32(chan);
if ((error = dev_wlc_ioctl(dev, WLC_SET_CHANNEL, &chan, sizeof(chan)))) error = dev_wlc_ioctl(dev, WLC_SET_CHANNEL, &chan, sizeof(chan));
if (error)
return error; return error;
g_wl_iw_params.target_channel = chan; g_wl_iw_params.target_channel = chan;
...@@ -414,7 +417,8 @@ wl_iw_get_freq(struct net_device *dev, ...@@ -414,7 +417,8 @@ wl_iw_get_freq(struct net_device *dev,
WL_TRACE(("%s: SIOCGIWFREQ\n", dev->name)); WL_TRACE(("%s: SIOCGIWFREQ\n", dev->name));
if ((error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci)))) error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci));
if (error)
return error; return error;
fwrq->m = dtoh32(ci.hw_channel); fwrq->m = dtoh32(ci.hw_channel);
...@@ -446,8 +450,12 @@ wl_iw_set_mode(struct net_device *dev, ...@@ -446,8 +450,12 @@ wl_iw_set_mode(struct net_device *dev,
infra = htod32(infra); infra = htod32(infra);
ap = htod32(ap); ap = htod32(ap);
if ((error = dev_wlc_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(infra))) error = dev_wlc_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(infra));
|| (error = dev_wlc_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap)))) if (error)
return error;
error = dev_wlc_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap));
if (error)
return error; return error;
return -EINPROGRESS; return -EINPROGRESS;
...@@ -461,8 +469,12 @@ wl_iw_get_mode(struct net_device *dev, ...@@ -461,8 +469,12 @@ wl_iw_get_mode(struct net_device *dev,
WL_TRACE(("%s: SIOCGIWMODE\n", dev->name)); WL_TRACE(("%s: SIOCGIWMODE\n", dev->name));
if ((error = dev_wlc_ioctl(dev, WLC_GET_INFRA, &infra, sizeof(infra))) error = dev_wlc_ioctl(dev, WLC_GET_INFRA, &infra, sizeof(infra));
|| (error = dev_wlc_ioctl(dev, WLC_GET_AP, &ap, sizeof(ap)))) if (error)
return error;
error = dev_wlc_ioctl(dev, WLC_GET_AP, &ap, sizeof(ap));
if (error)
return error; return error;
infra = dtoh32(infra); infra = dtoh32(infra);
...@@ -512,9 +524,9 @@ wl_iw_get_range(struct net_device *dev, ...@@ -512,9 +524,9 @@ wl_iw_get_range(struct net_device *dev,
range->min_nwid = range->max_nwid = 0; range->min_nwid = range->max_nwid = 0;
list->count = htod32(MAXCHANNEL); list->count = htod32(MAXCHANNEL);
if ((error = error = dev_wlc_ioctl(dev, WLC_GET_VALID_CHANNELS, channels,
dev_wlc_ioctl(dev, WLC_GET_VALID_CHANNELS, channels, (MAXCHANNEL + 1) * 4);
(MAXCHANNEL + 1) * 4))) { if (error) {
kfree(channels); kfree(channels);
return error; return error;
} }
...@@ -543,9 +555,9 @@ wl_iw_get_range(struct net_device *dev, ...@@ -543,9 +555,9 @@ wl_iw_get_range(struct net_device *dev,
range->avg_qual.noise = 0x100 - 75; range->avg_qual.noise = 0x100 - 75;
#endif #endif
if ((error = error = dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset,
dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, sizeof(rateset));
sizeof(rateset)))) { if (error) {
kfree(channels); kfree(channels);
return error; return error;
} }
...@@ -582,7 +594,8 @@ wl_iw_get_range(struct net_device *dev, ...@@ -582,7 +594,8 @@ wl_iw_get_range(struct net_device *dev,
} }
} }
if ((error = dev_wlc_ioctl(dev, WLC_GET_PHYTYPE, &i, sizeof(i)))) { error = dev_wlc_ioctl(dev, WLC_GET_PHYTYPE, &i, sizeof(i));
if (error) {
kfree(channels); kfree(channels);
return error; return error;
} }
...@@ -788,9 +801,9 @@ wl_iw_set_wap(struct net_device *dev, ...@@ -788,9 +801,9 @@ wl_iw_set_wap(struct net_device *dev,
wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params, wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params,
&join_params_size); &join_params_size);
if ((error = error = dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params,
dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);
join_params_size))) { if (error) {
WL_ERROR(("%s Invalid ioctl data=%d\n", __func__, error)); WL_ERROR(("%s Invalid ioctl data=%d\n", __func__, error));
} }
...@@ -881,7 +894,8 @@ wl_iw_get_aplist(struct net_device *dev, ...@@ -881,7 +894,8 @@ wl_iw_get_aplist(struct net_device *dev,
return -ENOMEM; return -ENOMEM;
memset(list, 0, buflen); memset(list, 0, buflen);
list->buflen = htod32(buflen); list->buflen = htod32(buflen);
if ((error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, buflen))) { error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, buflen);
if (error) {
WL_ERROR(("%d: Scan results error %d\n", __LINE__, error)); WL_ERROR(("%d: Scan results error %d\n", __LINE__, error));
kfree(list); kfree(list);
return error; return error;
...@@ -1288,9 +1302,9 @@ wl_iw_set_scan(struct net_device *dev, ...@@ -1288,9 +1302,9 @@ wl_iw_set_scan(struct net_device *dev,
} }
} }
#endif /* WIRELESS_EXT > 17 */ #endif /* WIRELESS_EXT > 17 */
if ((error = error = dev_wlc_ioctl(dev, WLC_SCAN, &g_specific_ssid,
dev_wlc_ioctl(dev, WLC_SCAN, &g_specific_ssid, sizeof(g_specific_ssid));
sizeof(g_specific_ssid)))) { if (error) {
WL_TRACE(("#### Set SCAN for %s failed with %d\n", WL_TRACE(("#### Set SCAN for %s failed with %d\n",
g_specific_ssid.SSID, error)); g_specific_ssid.SSID, error));
g_scan_specified_ssid = 0; g_scan_specified_ssid = 0;
...@@ -1441,7 +1455,8 @@ wl_iw_handle_scanresults_ies(char **event_p, char *end, ...@@ -1441,7 +1455,8 @@ wl_iw_handle_scanresults_ies(char **event_p, char *end,
int ptr_len = bi->ie_length; int ptr_len = bi->ie_length;
#ifdef BCMWPA2 #ifdef BCMWPA2
if ((ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_RSN_ID))) { ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_RSN_ID);
if (ie) {
iwe.cmd = IWEVGENIE; iwe.cmd = IWEVGENIE;
iwe.u.data.length = ie->len + 2; iwe.u.data.length = ie->len + 2;
event = event =
...@@ -1582,7 +1597,8 @@ wl_iw_get_scan_prep(wl_scan_results_t *list, ...@@ -1582,7 +1597,8 @@ wl_iw_get_scan_prep(wl_scan_results_t *list,
} }
} }
if ((ret = (event - extra)) < 0) { ret = event - extra;
if (ret < 0) {
WL_ERROR(("==> Wrong size\n")); WL_ERROR(("==> Wrong size\n"));
ret = 0; ret = 0;
} }
...@@ -1614,7 +1630,8 @@ wl_iw_get_scan(struct net_device *dev, ...@@ -1614,7 +1630,8 @@ wl_iw_get_scan(struct net_device *dev,
return -EINVAL; return -EINVAL;
} }
if ((error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci)))) error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci));
if (error)
return error; return error;
ci.scan_channel = dtoh32(ci.scan_channel); ci.scan_channel = dtoh32(ci.scan_channel);
if (ci.scan_channel) if (ci.scan_channel)
...@@ -1632,7 +1649,8 @@ wl_iw_get_scan(struct net_device *dev, ...@@ -1632,7 +1649,8 @@ wl_iw_get_scan(struct net_device *dev,
memset(list, 0, len); memset(list, 0, len);
list->buflen = htod32(len); list->buflen = htod32(len);
if ((error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, len))) { error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, len);
if (error) {
WL_ERROR(("%s: %s : Scan_results ERROR %d\n", dev->name, WL_ERROR(("%s: %s : Scan_results ERROR %d\n", dev->name,
__func__, error)); __func__, error));
dwrq->length = len; dwrq->length = len;
...@@ -1917,8 +1935,9 @@ wl_iw_set_essid(struct net_device *dev, ...@@ -1917,8 +1935,9 @@ wl_iw_set_essid(struct net_device *dev,
wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params, wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params,
&join_params_size); &join_params_size);
if ((error = error = dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params,
dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size))) join_params_size);
if (error)
WL_ERROR(("Invalid ioctl data=%d\n", error)); WL_ERROR(("Invalid ioctl data=%d\n", error));
if (g_ssid.SSID_len) { if (g_ssid.SSID_len) {
...@@ -1941,7 +1960,8 @@ wl_iw_get_essid(struct net_device *dev, ...@@ -1941,7 +1960,8 @@ wl_iw_get_essid(struct net_device *dev,
if (!extra) if (!extra)
return -EINVAL; return -EINVAL;
if ((error = dev_wlc_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid)))) { error = dev_wlc_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid));
if (error) {
WL_ERROR(("Error getting the SSID\n")); WL_ERROR(("Error getting the SSID\n"));
return error; return error;
} }
...@@ -2003,9 +2023,9 @@ wl_iw_set_rate(struct net_device *dev, ...@@ -2003,9 +2023,9 @@ wl_iw_set_rate(struct net_device *dev,
WL_TRACE(("%s: SIOCSIWRATE\n", dev->name)); WL_TRACE(("%s: SIOCSIWRATE\n", dev->name));
if ((error = error = dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset,
dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, sizeof(rateset));
sizeof(rateset)))) if (error)
return error; return error;
rateset.count = dtoh32(rateset.count); rateset.count = dtoh32(rateset.count);
...@@ -2035,9 +2055,9 @@ wl_iw_set_rate(struct net_device *dev, ...@@ -2035,9 +2055,9 @@ wl_iw_set_rate(struct net_device *dev,
break; break;
rateset.count = htod32(i); rateset.count = htod32(i);
if ((error = error = dev_wlc_ioctl(dev, WLC_SET_RATESET, &rateset,
dev_wlc_ioctl(dev, WLC_SET_RATESET, &rateset, sizeof(rateset));
sizeof(rateset)))) if (error)
return error; return error;
} }
...@@ -2052,7 +2072,8 @@ wl_iw_get_rate(struct net_device *dev, ...@@ -2052,7 +2072,8 @@ wl_iw_get_rate(struct net_device *dev,
WL_TRACE(("%s: SIOCGIWRATE\n", dev->name)); WL_TRACE(("%s: SIOCGIWRATE\n", dev->name));
if ((error = dev_wlc_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate)))) error = dev_wlc_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate));
if (error)
return error; return error;
rate = dtoh32(rate); rate = dtoh32(rate);
vwrq->value = rate * 500000; vwrq->value = rate * 500000;
...@@ -2075,7 +2096,8 @@ wl_iw_set_rts(struct net_device *dev, ...@@ -2075,7 +2096,8 @@ wl_iw_set_rts(struct net_device *dev,
else else
rts = vwrq->value; rts = vwrq->value;
if ((error = dev_wlc_intvar_set(dev, "rtsthresh", rts))) error = dev_wlc_intvar_set(dev, "rtsthresh", rts);
if (error)
return error; return error;
return 0; return 0;
...@@ -2089,7 +2111,8 @@ wl_iw_get_rts(struct net_device *dev, ...@@ -2089,7 +2111,8 @@ wl_iw_get_rts(struct net_device *dev,
WL_TRACE(("%s: SIOCGIWRTS\n", dev->name)); WL_TRACE(("%s: SIOCGIWRTS\n", dev->name));
if ((error = dev_wlc_intvar_get(dev, "rtsthresh", &rts))) error = dev_wlc_intvar_get(dev, "rtsthresh", &rts);
if (error)
return error; return error;
vwrq->value = rts; vwrq->value = rts;
...@@ -2114,7 +2137,8 @@ wl_iw_set_frag(struct net_device *dev, ...@@ -2114,7 +2137,8 @@ wl_iw_set_frag(struct net_device *dev,
else else
frag = vwrq->value; frag = vwrq->value;
if ((error = dev_wlc_intvar_set(dev, "fragthresh", frag))) error = dev_wlc_intvar_set(dev, "fragthresh", frag);
if (error)
return error; return error;
return 0; return 0;
...@@ -2128,7 +2152,8 @@ wl_iw_get_frag(struct net_device *dev, ...@@ -2128,7 +2152,8 @@ wl_iw_get_frag(struct net_device *dev,
WL_TRACE(("%s: SIOCGIWFRAG\n", dev->name)); WL_TRACE(("%s: SIOCGIWFRAG\n", dev->name));
if ((error = dev_wlc_intvar_get(dev, "fragthresh", &fragthreshold))) error = dev_wlc_intvar_get(dev, "fragthresh", &fragthreshold);
if (error)
return error; return error;
vwrq->value = fragthreshold; vwrq->value = fragthreshold;
...@@ -2151,8 +2176,8 @@ wl_iw_set_txpow(struct net_device *dev, ...@@ -2151,8 +2176,8 @@ wl_iw_set_txpow(struct net_device *dev,
disable += WL_RADIO_SW_DISABLE << 16; disable += WL_RADIO_SW_DISABLE << 16;
disable = htod32(disable); disable = htod32(disable);
if ((error = error = dev_wlc_ioctl(dev, WLC_SET_RADIO, &disable, sizeof(disable));
dev_wlc_ioctl(dev, WLC_SET_RADIO, &disable, sizeof(disable)))) if (error)
return error; return error;
if (disable & WL_RADIO_SW_DISABLE) if (disable & WL_RADIO_SW_DISABLE)
...@@ -2184,9 +2209,12 @@ wl_iw_get_txpow(struct net_device *dev, ...@@ -2184,9 +2209,12 @@ wl_iw_get_txpow(struct net_device *dev,
WL_TRACE(("%s: SIOCGIWTXPOW\n", dev->name)); WL_TRACE(("%s: SIOCGIWTXPOW\n", dev->name));
if ((error = error = dev_wlc_ioctl(dev, WLC_GET_RADIO, &disable, sizeof(disable));
dev_wlc_ioctl(dev, WLC_GET_RADIO, &disable, sizeof(disable))) if (error)
|| (error = dev_wlc_intvar_get(dev, "qtxpower", &txpwrdbm))) return error;
error = dev_wlc_intvar_get(dev, "qtxpower", &txpwrdbm);
if (error)
return error; return error;
disable = dtoh32(disable); disable = dtoh32(disable);
...@@ -2225,9 +2253,9 @@ wl_iw_set_retry(struct net_device *dev, ...@@ -2225,9 +2253,9 @@ wl_iw_set_retry(struct net_device *dev,
|| !(vwrq->flags & IW_RETRY_MIN)) { || !(vwrq->flags & IW_RETRY_MIN)) {
#endif #endif
lrl = htod32(vwrq->value); lrl = htod32(vwrq->value);
if ((error = error = dev_wlc_ioctl(dev, WLC_SET_LRL, &lrl,
dev_wlc_ioctl(dev, WLC_SET_LRL, &lrl, sizeof(lrl));
sizeof(lrl)))) if (error)
return error; return error;
} }
#if WIRELESS_EXT > 20 #if WIRELESS_EXT > 20
...@@ -2240,9 +2268,9 @@ wl_iw_set_retry(struct net_device *dev, ...@@ -2240,9 +2268,9 @@ wl_iw_set_retry(struct net_device *dev,
|| !(vwrq->flags & IW_RETRY_MAX)) { || !(vwrq->flags & IW_RETRY_MAX)) {
#endif #endif
srl = htod32(vwrq->value); srl = htod32(vwrq->value);
if ((error = error = dev_wlc_ioctl(dev, WLC_SET_SRL, &srl,
dev_wlc_ioctl(dev, WLC_SET_SRL, &srl, sizeof(srl));
sizeof(srl)))) if (error)
return error; return error;
} }
} }
...@@ -2263,8 +2291,12 @@ wl_iw_get_retry(struct net_device *dev, ...@@ -2263,8 +2291,12 @@ wl_iw_get_retry(struct net_device *dev,
if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME)
return -EINVAL; return -EINVAL;
if ((error = dev_wlc_ioctl(dev, WLC_GET_LRL, &lrl, sizeof(lrl))) || error = dev_wlc_ioctl(dev, WLC_GET_LRL, &lrl, sizeof(lrl));
(error = dev_wlc_ioctl(dev, WLC_GET_SRL, &srl, sizeof(srl)))) if (error)
return error;
error = dev_wlc_ioctl(dev, WLC_GET_SRL, &srl, sizeof(srl));
if (error)
return error; return error;
lrl = dtoh32(lrl); lrl = dtoh32(lrl);
...@@ -2300,9 +2332,9 @@ wl_iw_set_encode(struct net_device *dev, ...@@ -2300,9 +2332,9 @@ wl_iw_set_encode(struct net_device *dev,
for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS; for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS;
key.index++) { key.index++) {
val = htod32(key.index); val = htod32(key.index);
if ((error = error = dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val,
dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val, sizeof(val));
sizeof(val)))) if (error)
return error; return error;
val = dtoh32(val); val = dtoh32(val);
if (val) if (val)
...@@ -2318,9 +2350,9 @@ wl_iw_set_encode(struct net_device *dev, ...@@ -2318,9 +2350,9 @@ wl_iw_set_encode(struct net_device *dev,
if (!extra || !dwrq->length || (dwrq->flags & IW_ENCODE_NOKEY)) { if (!extra || !dwrq->length || (dwrq->flags & IW_ENCODE_NOKEY)) {
val = htod32(key.index); val = htod32(key.index);
if ((error = error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, &val,
dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, &val, sizeof(val));
sizeof(val)))) if (error)
return error; return error;
} else { } else {
key.len = dwrq->length; key.len = dwrq->length;
...@@ -2349,25 +2381,28 @@ wl_iw_set_encode(struct net_device *dev, ...@@ -2349,25 +2381,28 @@ wl_iw_set_encode(struct net_device *dev,
} }
swap_key_from_BE(&key); swap_key_from_BE(&key);
if ((error = error = dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key));
dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)))) if (error)
return error; return error;
} }
val = (dwrq->flags & IW_ENCODE_DISABLED) ? 0 : WEP_ENABLED; val = (dwrq->flags & IW_ENCODE_DISABLED) ? 0 : WEP_ENABLED;
if ((error = dev_wlc_intvar_get(dev, "wsec", &wsec))) error = dev_wlc_intvar_get(dev, "wsec", &wsec);
if (error)
return error; return error;
wsec &= ~(WEP_ENABLED); wsec &= ~(WEP_ENABLED);
wsec |= val; wsec |= val;
if ((error = dev_wlc_intvar_set(dev, "wsec", wsec))) error = dev_wlc_intvar_set(dev, "wsec", wsec);
if (error)
return error; return error;
val = (dwrq->flags & IW_ENCODE_RESTRICTED) ? 1 : 0; val = (dwrq->flags & IW_ENCODE_RESTRICTED) ? 1 : 0;
val = htod32(val); val = htod32(val);
if ((error = dev_wlc_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val)))) error = dev_wlc_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val));
if (error)
return error; return error;
return 0; return 0;
...@@ -2389,9 +2424,9 @@ wl_iw_get_encode(struct net_device *dev, ...@@ -2389,9 +2424,9 @@ wl_iw_get_encode(struct net_device *dev,
for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS; for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS;
key.index++) { key.index++) {
val = key.index; val = key.index;
if ((error = error = dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val,
dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val, sizeof(val));
sizeof(val)))) if (error)
return error; return error;
val = dtoh32(val); val = dtoh32(val);
if (val) if (val)
...@@ -2403,8 +2438,12 @@ wl_iw_get_encode(struct net_device *dev, ...@@ -2403,8 +2438,12 @@ wl_iw_get_encode(struct net_device *dev,
if (key.index >= DOT11_MAX_DEFAULT_KEYS) if (key.index >= DOT11_MAX_DEFAULT_KEYS)
key.index = 0; key.index = 0;
if ((error = dev_wlc_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec))) || error = dev_wlc_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec));
(error = dev_wlc_ioctl(dev, WLC_GET_AUTH, &auth, sizeof(auth)))) if (error)
return error;
error = dev_wlc_ioctl(dev, WLC_GET_AUTH, &auth, sizeof(auth));
if (error)
return error; return error;
swap_key_to_BE(&key); swap_key_to_BE(&key);
...@@ -2438,7 +2477,8 @@ wl_iw_set_power(struct net_device *dev, ...@@ -2438,7 +2477,8 @@ wl_iw_set_power(struct net_device *dev,
pm = vwrq->disabled ? PM_OFF : PM_MAX; pm = vwrq->disabled ? PM_OFF : PM_MAX;
pm = htod32(pm); pm = htod32(pm);
if ((error = dev_wlc_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm)))) error = dev_wlc_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm));
if (error)
return error; return error;
return 0; return 0;
...@@ -2453,7 +2493,8 @@ wl_iw_get_power(struct net_device *dev, ...@@ -2453,7 +2493,8 @@ wl_iw_get_power(struct net_device *dev,
WL_TRACE(("%s: SIOCGIWPOWER\n", dev->name)); WL_TRACE(("%s: SIOCGIWPOWER\n", dev->name));
if ((error = dev_wlc_ioctl(dev, WLC_GET_PM, &pm, sizeof(pm)))) error = dev_wlc_ioctl(dev, WLC_GET_PM, &pm, sizeof(pm));
if (error)
return error; return error;
pm = dtoh32(pm); pm = dtoh32(pm);
...@@ -2749,7 +2790,8 @@ wl_iw_set_wpaauth(struct net_device *dev, ...@@ -2749,7 +2790,8 @@ wl_iw_set_wpaauth(struct net_device *dev,
#endif #endif
WL_INFORM(("%s: %d: setting wpa_auth to 0x%0x\n", __func__, WL_INFORM(("%s: %d: setting wpa_auth to 0x%0x\n", __func__,
__LINE__, val)); __LINE__, val));
if ((error = dev_wlc_intvar_set(dev, "wpa_auth", val))) error = dev_wlc_intvar_set(dev, "wpa_auth", val);
if (error)
return error; return error;
break; break;
case IW_AUTH_CIPHER_PAIRWISE: case IW_AUTH_CIPHER_PAIRWISE:
...@@ -2773,28 +2815,30 @@ wl_iw_set_wpaauth(struct net_device *dev, ...@@ -2773,28 +2815,30 @@ wl_iw_set_wpaauth(struct net_device *dev,
WL_WSEC(("%s: %s: 'Privacy invoked' TRUE but clearing " WL_WSEC(("%s: %s: 'Privacy invoked' TRUE but clearing "
"wsec, assuming " "we're a WPS enrollee\n", "wsec, assuming " "we're a WPS enrollee\n",
dev->name, __func__)); dev->name, __func__));
if ((error = error = dev_wlc_intvar_set(dev, "is_WPS_enrollee",
dev_wlc_intvar_set(dev, "is_WPS_enrollee", TRUE);
TRUE))) { if (error) {
WL_WSEC(("Failed to set is_WPS_enrollee\n")); WL_WSEC(("Failed to set is_WPS_enrollee\n"));
return error; return error;
} }
} else if (val) { } else if (val) {
if ((error = error = dev_wlc_intvar_set(dev, "is_WPS_enrollee",
dev_wlc_intvar_set(dev, "is_WPS_enrollee", FALSE);
FALSE))) { if (error) {
WL_WSEC(("Failed to clear is_WPS_enrollee\n")); WL_WSEC(("Failed to clear is_WPS_enrollee\n"));
return error; return error;
} }
} }
if ((error = dev_wlc_intvar_set(dev, "wsec", val))) error = dev_wlc_intvar_set(dev, "wsec", val);
if (error)
return error; return error;
break; break;
case IW_AUTH_KEY_MGMT: case IW_AUTH_KEY_MGMT:
if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val))) error = dev_wlc_intvar_get(dev, "wpa_auth", &val);
if (error)
return error; return error;
if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
...@@ -2813,7 +2857,8 @@ wl_iw_set_wpaauth(struct net_device *dev, ...@@ -2813,7 +2857,8 @@ wl_iw_set_wpaauth(struct net_device *dev,
#endif #endif
WL_INFORM(("%s: %d: setting wpa_auth to %d\n", __func__, WL_INFORM(("%s: %d: setting wpa_auth to %d\n", __func__,
__LINE__, val)); __LINE__, val));
if ((error = dev_wlc_intvar_set(dev, "wpa_auth", val))) error = dev_wlc_intvar_set(dev, "wpa_auth", val);
if (error)
return error; return error;
break; break;
...@@ -2833,15 +2878,19 @@ wl_iw_set_wpaauth(struct net_device *dev, ...@@ -2833,15 +2878,19 @@ wl_iw_set_wpaauth(struct net_device *dev,
val = 2; val = 2;
else else
error = 1; error = 1;
if (!error && (error = dev_wlc_intvar_set(dev, "auth", val))) if (!error) {
error = dev_wlc_intvar_set(dev, "auth", val);
if (error)
return error; return error;
}
break; break;
case IW_AUTH_WPA_ENABLED: case IW_AUTH_WPA_ENABLED:
if (paramval == 0) { if (paramval == 0) {
iw->pwsec = 0; iw->pwsec = 0;
iw->gwsec = 0; iw->gwsec = 0;
if ((error = dev_wlc_intvar_get(dev, "wsec", &val))) error = dev_wlc_intvar_get(dev, "wsec", &val);
if (error)
return error; return error;
if (val & (TKIP_ENABLED | AES_ENABLED)) { if (val & (TKIP_ENABLED | AES_ENABLED)) {
val &= ~(TKIP_ENABLED | AES_ENABLED); val &= ~(TKIP_ENABLED | AES_ENABLED);
...@@ -2874,31 +2923,33 @@ wl_iw_set_wpaauth(struct net_device *dev, ...@@ -2874,31 +2923,33 @@ wl_iw_set_wpaauth(struct net_device *dev,
if (paramval == 0) { if (paramval == 0) {
iw->privacy_invoked = FALSE; iw->privacy_invoked = FALSE;
if ((error = error = dev_wlc_intvar_set(dev,
dev_wlc_intvar_set(dev, "is_WPS_enrollee", "is_WPS_enrollee", FALSE);
FALSE))) { if (error) {
WL_WSEC(("Failed to clear iovar " WL_WSEC(("Failed to clear iovar "
"is_WPS_enrollee\n")); "is_WPS_enrollee\n"));
return error; return error;
} }
} else { } else {
iw->privacy_invoked = TRUE; iw->privacy_invoked = TRUE;
if ((error = error = dev_wlc_intvar_get(dev, "wsec", &wsec);
dev_wlc_intvar_get(dev, "wsec", &wsec))) if (error)
return error; return error;
if (!(IW_WSEC_ENABLED(wsec))) { if (!(IW_WSEC_ENABLED(wsec))) {
if ((error = error = dev_wlc_intvar_set(dev,
dev_wlc_intvar_set(dev, "is_WPS_enrollee",
"is_WPS_enrollee", TRUE))) { TRUE);
if (error) {
WL_WSEC(("Failed to set iovar " WL_WSEC(("Failed to set iovar "
"is_WPS_enrollee\n")); "is_WPS_enrollee\n"));
return error; return error;
} }
} else { } else {
if ((error = error = dev_wlc_intvar_set(dev,
dev_wlc_intvar_set(dev, "is_WPS_enrollee",
"is_WPS_enrollee", FALSE))) { FALSE);
if (error) {
WL_WSEC(("Failed to clear " WL_WSEC(("Failed to clear "
"is_WPS_enrollee\n")); "is_WPS_enrollee\n"));
return error; return error;
...@@ -2937,7 +2988,8 @@ wl_iw_get_wpaauth(struct net_device *dev, ...@@ -2937,7 +2988,8 @@ wl_iw_get_wpaauth(struct net_device *dev,
switch (paramid) { switch (paramid) {
case IW_AUTH_WPA_VERSION: case IW_AUTH_WPA_VERSION:
if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val))) error = dev_wlc_intvar_get(dev, "wpa_auth", &val);
if (error)
return error; return error;
if (val & (WPA_AUTH_NONE | WPA_AUTH_DISABLED)) if (val & (WPA_AUTH_NONE | WPA_AUTH_DISABLED))
paramval = IW_AUTH_WPA_VERSION_DISABLED; paramval = IW_AUTH_WPA_VERSION_DISABLED;
...@@ -2969,7 +3021,8 @@ wl_iw_get_wpaauth(struct net_device *dev, ...@@ -2969,7 +3021,8 @@ wl_iw_get_wpaauth(struct net_device *dev,
paramval = IW_AUTH_CIPHER_NONE; paramval = IW_AUTH_CIPHER_NONE;
break; break;
case IW_AUTH_KEY_MGMT: case IW_AUTH_KEY_MGMT:
if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val))) error = dev_wlc_intvar_get(dev, "wpa_auth", &val);
if (error)
return error; return error;
if (VAL_PSK(val)) if (VAL_PSK(val))
paramval = IW_AUTH_KEY_MGMT_PSK; paramval = IW_AUTH_KEY_MGMT_PSK;
...@@ -2992,7 +3045,8 @@ wl_iw_get_wpaauth(struct net_device *dev, ...@@ -2992,7 +3045,8 @@ wl_iw_get_wpaauth(struct net_device *dev,
break; break;
case IW_AUTH_80211_AUTH_ALG: case IW_AUTH_80211_AUTH_ALG:
if ((error = dev_wlc_intvar_get(dev, "auth", &val))) error = dev_wlc_intvar_get(dev, "auth", &val);
if (error)
return error; return error;
if (!val) if (!val)
paramval = IW_AUTH_ALG_OPEN_SYSTEM; paramval = IW_AUTH_ALG_OPEN_SYSTEM;
...@@ -3000,7 +3054,8 @@ wl_iw_get_wpaauth(struct net_device *dev, ...@@ -3000,7 +3054,8 @@ wl_iw_get_wpaauth(struct net_device *dev,
paramval = IW_AUTH_ALG_SHARED_KEY; paramval = IW_AUTH_ALG_SHARED_KEY;
break; break;
case IW_AUTH_WPA_ENABLED: case IW_AUTH_WPA_ENABLED:
if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val))) error = dev_wlc_intvar_get(dev, "wpa_auth", &val);
if (error)
return error; return error;
if (val) if (val)
paramval = TRUE; paramval = TRUE;
...@@ -3130,13 +3185,20 @@ int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -3130,13 +3185,20 @@ int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
WL_TRACE(("\n%s, cmd:%x alled via dhd->do_ioctl()entry point\n", WL_TRACE(("\n%s, cmd:%x alled via dhd->do_ioctl()entry point\n",
__func__, cmd)); __func__, cmd));
if (cmd < SIOCIWFIRST || IW_IOCTL_IDX(cmd) >= ARRAYSIZE(wl_iw_handler) if (cmd < SIOCIWFIRST ||
|| !(handler = wl_iw_handler[IW_IOCTL_IDX(cmd)])) { IW_IOCTL_IDX(cmd) >= ARRAYSIZE(wl_iw_handler)) {
WL_ERROR(("%s: error in cmd=%x : not supported\n", __func__, WL_ERROR(("%s: error in cmd=%x : out of range\n", __func__,
cmd)); cmd));
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
handler = wl_iw_handler[IW_IOCTL_IDX(cmd)];
if (!handler) {
WL_ERROR(("%s: error in cmd=%x : not supported\n",
__func__, cmd));
return -EOPNOTSUPP;
}
switch (cmd) { switch (cmd) {
case SIOCSIWESSID: case SIOCSIWESSID:
...@@ -3203,7 +3265,8 @@ int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -3203,7 +3265,8 @@ int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
__func__, cmd, wrq->u.data.length, max_tokens)); __func__, cmd, wrq->u.data.length, max_tokens));
return -E2BIG; return -E2BIG;
} }
if (!(extra = kmalloc(max_tokens * token_size, GFP_KERNEL))) extra = kmalloc(max_tokens * token_size, GFP_KERNEL);
if (!extra)
return -ENOMEM; return -ENOMEM;
if (copy_from_user if (copy_from_user
...@@ -3542,17 +3605,17 @@ wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats) ...@@ -3542,17 +3605,17 @@ wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats)
scb_val_t scb_val; scb_val_t scb_val;
phy_noise = 0; phy_noise = 0;
if ((res = res = dev_wlc_ioctl(dev, WLC_GET_PHY_NOISE, &phy_noise,
dev_wlc_ioctl(dev, WLC_GET_PHY_NOISE, &phy_noise, sizeof(phy_noise));
sizeof(phy_noise)))) if (res)
goto done; goto done;
phy_noise = dtoh32(phy_noise); phy_noise = dtoh32(phy_noise);
WL_TRACE(("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise)); WL_TRACE(("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise));
bzero(&scb_val, sizeof(scb_val_t)); bzero(&scb_val, sizeof(scb_val_t));
if ((res = res = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t));
dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)))) if (res)
goto done; goto done;
rssi = dtoh32(scb_val.val); rssi = dtoh32(scb_val.val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment