diff options
Diffstat (limited to 'drivers/staging/rtl8192e/rtllib_wx.c')
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_wx.c | 76 |
1 files changed, 35 insertions, 41 deletions
diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 2e486ccb6432..ab1b8217c4e0 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -140,12 +140,12 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, bool is40M = false, isShortGI = false; u8 max_mcs = 0; - if (!memcmp(network->bssht.bdHTCapBuf, EWC11NHTCap, 4)) + if (!memcmp(network->bssht.bd_ht_cap_buf, EWC11NHTCap, 4)) ht_cap = (struct ht_capab_ele *) - &network->bssht.bdHTCapBuf[4]; + &network->bssht.bd_ht_cap_buf[4]; else ht_cap = (struct ht_capab_ele *) - &network->bssht.bdHTCapBuf[0]; + &network->bssht.bd_ht_cap_buf[0]; is40M = (ht_cap->ChlWidth) ? 1 : 0; isShortGI = (ht_cap->ChlWidth) ? ((ht_cap->ShortGI40Mhz) ? 1 : 0) : @@ -160,8 +160,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, iwe.cmd = SIOCGIWRATE; iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; iwe.u.bitrate.value = max_rate * 500000; - start = iwe_stream_add_event_rsl(info, start, stop, &iwe, - IW_EV_PARAM_LEN); + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_PARAM_LEN); iwe.cmd = IWEVCUSTOM; iwe.u.data.length = p - custom; if (iwe.u.data.length) @@ -181,15 +180,13 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, if (!(network->stats.mask & RTLLIB_STATMASK_SIGNAL)) iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; iwe.u.qual.updated = 7; - start = iwe_stream_add_event_rsl(info, start, stop, &iwe, - IW_EV_QUAL_LEN); + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN); iwe.cmd = IWEVCUSTOM; p = custom; iwe.u.data.length = p - custom; if (iwe.u.data.length) - start = iwe_stream_add_point_rsl(info, start, stop, - &iwe, custom); + start = iwe_stream_add_point_rsl(info, start, stop, &iwe, custom); memset(&iwe, 0, sizeof(iwe)); if (network->wpa_ie_len) { @@ -238,8 +235,8 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, } int rtllib_wx_get_scan(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct rtllib_network *network; unsigned long flags; @@ -285,8 +282,8 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee, EXPORT_SYMBOL(rtllib_wx_get_scan); int rtllib_wx_set_encode(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *keybuf) + struct iw_request_info *info, + union iwreq_data *wrqu, char *keybuf) { struct iw_point *erq = &(wrqu->encoding); struct net_device *dev = ieee->dev; @@ -324,11 +321,11 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, * and if no key index was provided, de-init them all */ for (i = 0; i < NUM_WEP_KEYS; i++) { - if (ieee->crypt_info.crypt[i] != NULL) { + if (ieee->crypt_info.crypt[i]) { if (key_provided) break; lib80211_crypt_delayed_deinit(&ieee->crypt_info, - &ieee->crypt_info.crypt[i]); + &ieee->crypt_info.crypt[i]); } } @@ -344,7 +341,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, sec.enabled = 1; sec.flags |= SEC_ENABLED; - if (*crypt != NULL && (*crypt)->ops != NULL && + if (*crypt && (*crypt)->ops && strcmp((*crypt)->ops->name, "R-WEP") != 0) { /* changing to use WEP; deinit previously used algorithm * on this key @@ -352,12 +349,12 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); } - if (*crypt == NULL) { + if (!*crypt) { struct lib80211_crypt_data *new_crypt; /* take WEP into use */ new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); - if (new_crypt == NULL) + if (!new_crypt) return -ENOMEM; new_crypt->ops = lib80211_get_crypto_ops("R-WEP"); if (!new_crypt->ops) { @@ -406,8 +403,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, NULL, (*crypt)->priv); if (len == 0) { /* Set a default key of all 0 */ - netdev_info(ieee->dev, "Setting key %d to all zero.\n", - key); + netdev_info(ieee->dev, "Setting key %d to all zero.\n", key); memset(sec.keys[key], 0, 13); (*crypt)->ops->set_key(sec.keys[key], 13, NULL, @@ -460,8 +456,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, EXPORT_SYMBOL(rtllib_wx_set_encode); int rtllib_wx_get_encode(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *keybuf) + struct iw_request_info *info, + union iwreq_data *wrqu, char *keybuf) { struct iw_point *erq = &(wrqu->encoding); int len, key; @@ -484,7 +480,7 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee, erq->flags = key + 1; - if (crypt == NULL || crypt->ops == NULL) { + if (!crypt || !crypt->ops) { erq->length = 0; erq->flags |= IW_ENCODE_DISABLED; return 0; @@ -505,8 +501,8 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee, EXPORT_SYMBOL(rtllib_wx_get_encode); int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; struct net_device *dev = ieee->dev; @@ -549,7 +545,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); for (i = 0; i < NUM_WEP_KEYS; i++) { - if (ieee->crypt_info.crypt[i] != NULL) + if (ieee->crypt_info.crypt[i]) break; } if (i == NUM_WEP_KEYS) { @@ -582,7 +578,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, netdev_dbg(dev, "alg name:%s\n", alg); ops = lib80211_get_crypto_ops(alg); - if (ops == NULL) { + if (!ops) { char tempbuf[100]; memset(tempbuf, 0x00, 100); @@ -590,19 +586,19 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, request_module("%s", tempbuf); ops = lib80211_get_crypto_ops(alg); } - if (ops == NULL) { + if (!ops) { netdev_info(dev, "========>unknown crypto alg %d\n", ext->alg); ret = -EINVAL; goto done; } - if (*crypt == NULL || (*crypt)->ops != ops) { + if (!*crypt || (*crypt)->ops != ops) { struct lib80211_crypt_data *new_crypt; lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); - if (new_crypt == NULL) { + if (!new_crypt) { ret = -ENOMEM; goto done; } @@ -610,7 +606,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) new_crypt->priv = new_crypt->ops->init(idx); - if (new_crypt->priv == NULL) { + if (!new_crypt->priv) { kfree(new_crypt); ret = -EINVAL; goto done; @@ -663,8 +659,8 @@ done: EXPORT_SYMBOL(rtllib_wx_set_encode_ext); int rtllib_wx_set_mlme(struct rtllib_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { u8 i = 0; bool deauth = false; @@ -710,8 +706,8 @@ int rtllib_wx_set_mlme(struct rtllib_device *ieee, EXPORT_SYMBOL(rtllib_wx_set_mlme); int rtllib_wx_set_auth(struct rtllib_device *ieee, - struct iw_request_info *info, - struct iw_param *data, char *extra) + struct iw_request_info *info, + struct iw_param *data, char *extra) { switch (data->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: @@ -766,17 +762,15 @@ int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len) u8 *buf; u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04}; - if (len > MAX_WPA_IE_LEN || (len && ie == NULL)) + if (len > MAX_WPA_IE_LEN || (len && !ie)) return -EINVAL; if (len) { eid = ie[0]; - if ((eid == MFIE_TYPE_GENERIC) && (!memcmp(&ie[2], - wps_oui, 4))) { - + if ((eid == MFIE_TYPE_GENERIC) && (!memcmp(&ie[2], wps_oui, 4))) { ieee->wps_ie_len = min_t(size_t, len, MAX_WZC_IE_LEN); buf = kmemdup(ie, ieee->wps_ie_len, GFP_KERNEL); - if (buf == NULL) + if (!buf) return -ENOMEM; ieee->wps_ie = buf; return 0; @@ -789,7 +783,7 @@ int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len) if (len != ie[1]+2) return -EINVAL; buf = kmemdup(ie, len, GFP_KERNEL); - if (buf == NULL) + if (!buf) return -ENOMEM; kfree(ieee->wpa_ie); ieee->wpa_ie = buf; |