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;
ssid.SSID_len = dtoh32(ssid.SSID_len);
return 0;
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__,
ssid.SSID));
return error;
}
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;
g_wl_iw_params.target_channel = chan;
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;
fwrq->m = dtoh32(ci.hw_channel);
infra = htod32(infra);
ap = htod32(ap);
- if ((error = dev_wlc_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(infra)))
- || (error = dev_wlc_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap))))
+ error = dev_wlc_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(infra));
+ if (error)
+ return error;
+
+ error = dev_wlc_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap));
+ if (error)
return error;
return -EINPROGRESS;
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_AP, &ap, sizeof(ap))))
+ error = dev_wlc_ioctl(dev, WLC_GET_INFRA, &infra, sizeof(infra));
+ if (error)
+ return error;
+
+ error = dev_wlc_ioctl(dev, WLC_GET_AP, &ap, sizeof(ap));
+ if (error)
return error;
infra = dtoh32(infra);
range->min_nwid = range->max_nwid = 0;
list->count = htod32(MAXCHANNEL);
- if ((error =
- dev_wlc_ioctl(dev, WLC_GET_VALID_CHANNELS, channels,
- (MAXCHANNEL + 1) * 4))) {
+ error = dev_wlc_ioctl(dev, WLC_GET_VALID_CHANNELS, channels,
+ (MAXCHANNEL + 1) * 4);
+ if (error) {
kfree(channels);
return error;
}
range->avg_qual.noise = 0x100 - 75;
#endif
- if ((error =
- dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset,
- sizeof(rateset)))) {
+ error = dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset,
+ sizeof(rateset));
+ if (error) {
kfree(channels);
return error;
}
}
}
- 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);
return error;
}
wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params,
&join_params_size);
- if ((error =
- dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params,
- join_params_size))) {
+ error = dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params,
+ join_params_size);
+ if (error) {
WL_ERROR(("%s Invalid ioctl data=%d\n", __func__, error));
}
return -ENOMEM;
memset(list, 0, 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));
kfree(list);
return error;
}
}
#endif /* WIRELESS_EXT > 17 */
- if ((error =
- dev_wlc_ioctl(dev, WLC_SCAN, &g_specific_ssid,
- sizeof(g_specific_ssid)))) {
+ error = dev_wlc_ioctl(dev, WLC_SCAN, &g_specific_ssid,
+ sizeof(g_specific_ssid));
+ if (error) {
WL_TRACE(("#### Set SCAN for %s failed with %d\n",
g_specific_ssid.SSID, error));
g_scan_specified_ssid = 0;
int ptr_len = bi->ie_length;
#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.u.data.length = ie->len + 2;
event =
}
}
- if ((ret = (event - extra)) < 0) {
+ ret = event - extra;
+ if (ret < 0) {
WL_ERROR(("==> Wrong size\n"));
ret = 0;
}
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;
ci.scan_channel = dtoh32(ci.scan_channel);
if (ci.scan_channel)
memset(list, 0, 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,
__func__, error));
dwrq->length = len;
wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params,
&join_params_size);
- if ((error =
- dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size)))
+ error = dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params,
+ join_params_size);
+ if (error)
WL_ERROR(("Invalid ioctl data=%d\n", error));
if (g_ssid.SSID_len) {
if (!extra)
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"));
return error;
}
WL_TRACE(("%s: SIOCSIWRATE\n", dev->name));
- if ((error =
- dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset,
- sizeof(rateset))))
+ error = dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset,
+ sizeof(rateset));
+ if (error)
return error;
rateset.count = dtoh32(rateset.count);
break;
rateset.count = htod32(i);
- if ((error =
- dev_wlc_ioctl(dev, WLC_SET_RATESET, &rateset,
- sizeof(rateset))))
+ error = dev_wlc_ioctl(dev, WLC_SET_RATESET, &rateset,
+ sizeof(rateset));
+ if (error)
return error;
}
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;
rate = dtoh32(rate);
vwrq->value = rate * 500000;
else
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 0;
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;
vwrq->value = rts;
else
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 0;
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;
vwrq->value = fragthreshold;
disable += WL_RADIO_SW_DISABLE << 16;
disable = htod32(disable);
- if ((error =
- dev_wlc_ioctl(dev, WLC_SET_RADIO, &disable, sizeof(disable))))
+ error = dev_wlc_ioctl(dev, WLC_SET_RADIO, &disable, sizeof(disable));
+ if (error)
return error;
if (disable & WL_RADIO_SW_DISABLE)
WL_TRACE(("%s: SIOCGIWTXPOW\n", dev->name));
- if ((error =
- dev_wlc_ioctl(dev, WLC_GET_RADIO, &disable, sizeof(disable)))
- || (error = dev_wlc_intvar_get(dev, "qtxpower", &txpwrdbm)))
+ error = dev_wlc_ioctl(dev, WLC_GET_RADIO, &disable, sizeof(disable));
+ if (error)
+ return error;
+
+ error = dev_wlc_intvar_get(dev, "qtxpower", &txpwrdbm);
+ if (error)
return error;
disable = dtoh32(disable);
|| !(vwrq->flags & IW_RETRY_MIN)) {
#endif
lrl = htod32(vwrq->value);
- if ((error =
- dev_wlc_ioctl(dev, WLC_SET_LRL, &lrl,
- sizeof(lrl))))
+ error = dev_wlc_ioctl(dev, WLC_SET_LRL, &lrl,
+ sizeof(lrl));
+ if (error)
return error;
}
#if WIRELESS_EXT > 20
|| !(vwrq->flags & IW_RETRY_MAX)) {
#endif
srl = htod32(vwrq->value);
- if ((error =
- dev_wlc_ioctl(dev, WLC_SET_SRL, &srl,
- sizeof(srl))))
+ error = dev_wlc_ioctl(dev, WLC_SET_SRL, &srl,
+ sizeof(srl));
+ if (error)
return error;
}
}
if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME)
return -EINVAL;
- if ((error = dev_wlc_ioctl(dev, WLC_GET_LRL, &lrl, sizeof(lrl))) ||
- (error = dev_wlc_ioctl(dev, WLC_GET_SRL, &srl, sizeof(srl))))
+ error = dev_wlc_ioctl(dev, WLC_GET_LRL, &lrl, sizeof(lrl));
+ if (error)
+ return error;
+
+ error = dev_wlc_ioctl(dev, WLC_GET_SRL, &srl, sizeof(srl));
+ if (error)
return error;
lrl = dtoh32(lrl);
for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS;
key.index++) {
val = htod32(key.index);
- if ((error =
- dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val,
- sizeof(val))))
+ error = dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val,
+ sizeof(val));
+ if (error)
return error;
val = dtoh32(val);
if (val)
if (!extra || !dwrq->length || (dwrq->flags & IW_ENCODE_NOKEY)) {
val = htod32(key.index);
- if ((error =
- dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, &val,
- sizeof(val))))
+ error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, &val,
+ sizeof(val));
+ if (error)
return error;
} else {
key.len = dwrq->length;
}
swap_key_from_BE(&key);
- if ((error =
- dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))
+ error = dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key));
+ if (error)
return error;
}
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;
wsec &= ~(WEP_ENABLED);
wsec |= val;
- if ((error = dev_wlc_intvar_set(dev, "wsec", wsec)))
+ error = dev_wlc_intvar_set(dev, "wsec", wsec);
+ if (error)
return error;
val = (dwrq->flags & IW_ENCODE_RESTRICTED) ? 1 : 0;
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 0;
for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS;
key.index++) {
val = key.index;
- if ((error =
- dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val,
- sizeof(val))))
+ error = dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val,
+ sizeof(val));
+ if (error)
return error;
val = dtoh32(val);
if (val)
if (key.index >= DOT11_MAX_DEFAULT_KEYS)
key.index = 0;
- if ((error = dev_wlc_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec))) ||
- (error = dev_wlc_ioctl(dev, WLC_GET_AUTH, &auth, sizeof(auth))))
+ error = dev_wlc_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec));
+ if (error)
+ return error;
+
+ error = dev_wlc_ioctl(dev, WLC_GET_AUTH, &auth, sizeof(auth));
+ if (error)
return error;
swap_key_to_BE(&key);
pm = vwrq->disabled ? PM_OFF : PM_MAX;
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 0;
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;
pm = dtoh32(pm);
#endif
WL_INFORM(("%s: %d: setting wpa_auth to 0x%0x\n", __func__,
__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;
break;
case IW_AUTH_CIPHER_PAIRWISE:
WL_WSEC(("%s: %s: 'Privacy invoked' TRUE but clearing "
"wsec, assuming " "we're a WPS enrollee\n",
dev->name, __func__));
- if ((error =
- dev_wlc_intvar_set(dev, "is_WPS_enrollee",
- TRUE))) {
+ error = dev_wlc_intvar_set(dev, "is_WPS_enrollee",
+ TRUE);
+ if (error) {
WL_WSEC(("Failed to set is_WPS_enrollee\n"));
return error;
}
} else if (val) {
- if ((error =
- dev_wlc_intvar_set(dev, "is_WPS_enrollee",
- FALSE))) {
+ error = dev_wlc_intvar_set(dev, "is_WPS_enrollee",
+ FALSE);
+ if (error) {
WL_WSEC(("Failed to clear is_WPS_enrollee\n"));
return error;
}
}
- if ((error = dev_wlc_intvar_set(dev, "wsec", val)))
+ error = dev_wlc_intvar_set(dev, "wsec", val);
+ if (error)
return error;
break;
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;
if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
#endif
WL_INFORM(("%s: %d: setting wpa_auth to %d\n", __func__,
__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;
break;
val = 2;
else
error = 1;
- if (!error && (error = dev_wlc_intvar_set(dev, "auth", val)))
- return error;
+ if (!error) {
+ error = dev_wlc_intvar_set(dev, "auth", val);
+ if (error)
+ return error;
+ }
break;
case IW_AUTH_WPA_ENABLED:
if (paramval == 0) {
iw->pwsec = 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;
if (val & (TKIP_ENABLED | AES_ENABLED)) {
val &= ~(TKIP_ENABLED | AES_ENABLED);
if (paramval == 0) {
iw->privacy_invoked = FALSE;
- if ((error =
- dev_wlc_intvar_set(dev, "is_WPS_enrollee",
- FALSE))) {
+ error = dev_wlc_intvar_set(dev,
+ "is_WPS_enrollee", FALSE);
+ if (error) {
WL_WSEC(("Failed to clear iovar "
"is_WPS_enrollee\n"));
return error;
}
} else {
iw->privacy_invoked = TRUE;
- if ((error =
- dev_wlc_intvar_get(dev, "wsec", &wsec)))
+ error = dev_wlc_intvar_get(dev, "wsec", &wsec);
+ if (error)
return error;
if (!(IW_WSEC_ENABLED(wsec))) {
- if ((error =
- dev_wlc_intvar_set(dev,
- "is_WPS_enrollee", TRUE))) {
+ error = dev_wlc_intvar_set(dev,
+ "is_WPS_enrollee",
+ TRUE);
+ if (error) {
WL_WSEC(("Failed to set iovar "
"is_WPS_enrollee\n"));
return error;
}
} else {
- if ((error =
- dev_wlc_intvar_set(dev,
- "is_WPS_enrollee", FALSE))) {
+ error = dev_wlc_intvar_set(dev,
+ "is_WPS_enrollee",
+ FALSE);
+ if (error) {
WL_WSEC(("Failed to clear "
"is_WPS_enrollee\n"));
return error;
switch (paramid) {
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;
if (val & (WPA_AUTH_NONE | WPA_AUTH_DISABLED))
paramval = IW_AUTH_WPA_VERSION_DISABLED;
paramval = IW_AUTH_CIPHER_NONE;
break;
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;
if (VAL_PSK(val))
paramval = IW_AUTH_KEY_MGMT_PSK;
break;
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;
if (!val)
paramval = IW_AUTH_ALG_OPEN_SYSTEM;
paramval = IW_AUTH_ALG_SHARED_KEY;
break;
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;
if (val)
paramval = TRUE;
WL_TRACE(("\n%s, cmd:%x alled via dhd->do_ioctl()entry point\n",
__func__, cmd));
- if (cmd < SIOCIWFIRST || IW_IOCTL_IDX(cmd) >= ARRAYSIZE(wl_iw_handler)
- || !(handler = wl_iw_handler[IW_IOCTL_IDX(cmd)])) {
- WL_ERROR(("%s: error in cmd=%x : not supported\n", __func__,
- cmd));
+ if (cmd < SIOCIWFIRST ||
+ IW_IOCTL_IDX(cmd) >= ARRAYSIZE(wl_iw_handler)) {
+ WL_ERROR(("%s: error in cmd=%x : out of range\n", __func__,
+ cmd));
+ 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;
}
__func__, cmd, wrq->u.data.length, max_tokens));
return -E2BIG;
}
- if (!(extra = kmalloc(max_tokens * token_size, GFP_KERNEL)))
+ extra = kmalloc(max_tokens * token_size, GFP_KERNEL);
+ if (!extra)
return -ENOMEM;
if (copy_from_user
scb_val_t scb_val;
phy_noise = 0;
- if ((res =
- dev_wlc_ioctl(dev, WLC_GET_PHY_NOISE, &phy_noise,
- sizeof(phy_noise))))
+ res = dev_wlc_ioctl(dev, WLC_GET_PHY_NOISE, &phy_noise,
+ sizeof(phy_noise));
+ if (res)
goto done;
phy_noise = dtoh32(phy_noise);
WL_TRACE(("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise));
bzero(&scb_val, sizeof(scb_val_t));
- if ((res =
- dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t))))
+ res = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t));
+ if (res)
goto done;
rssi = dtoh32(scb_val.val);