Commit 4c29207a authored by Mateusz Kulikowski's avatar Mateusz Kulikowski Committed by Greg Kroah-Hartman

staging: rtl8192e: Fix CONSTANT_COMPARISON warnings

Remove yoda conditions where pointed by checkpatch.
Signed-off-by: default avatarMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fc00af0c
...@@ -995,8 +995,8 @@ void rtl92e_link_change(struct net_device *dev) ...@@ -995,8 +995,8 @@ void rtl92e_link_change(struct net_device *dev)
if (ieee->state == RTLLIB_LINKED) { if (ieee->state == RTLLIB_LINKED) {
_rtl92e_net_update(dev); _rtl92e_net_update(dev);
priv->ops->update_ratr_table(dev); priv->ops->update_ratr_table(dev);
if ((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || if ((ieee->pairwise_key_type == KEY_TYPE_WEP40) ||
(KEY_TYPE_WEP104 == ieee->pairwise_key_type)) (ieee->pairwise_key_type == KEY_TYPE_WEP104))
rtl92e_enable_hw_security_config(dev); rtl92e_enable_hw_security_config(dev);
} else { } else {
rtl92e_writeb(dev, 0x173, 0); rtl92e_writeb(dev, 0x173, 0);
...@@ -1885,7 +1885,7 @@ static void _rtl92e_translate_rx_signal_stats(struct net_device *dev, ...@@ -1885,7 +1885,7 @@ static void _rtl92e_translate_rx_signal_stats(struct net_device *dev,
praddr = hdr->addr1; praddr = hdr->addr1;
bpacket_match_bssid = bpacket_match_bssid =
((RTLLIB_FTYPE_CTL != type) && ((type != RTLLIB_FTYPE_CTL) &&
ether_addr_equal(priv->rtllib->current_network.bssid, ether_addr_equal(priv->rtllib->current_network.bssid,
(fc & RTLLIB_FCTL_TODS) ? hdr->addr1 : (fc & RTLLIB_FCTL_TODS) ? hdr->addr1 :
(fc & RTLLIB_FCTL_FROMDS) ? hdr->addr2 : (fc & RTLLIB_FCTL_FROMDS) ? hdr->addr2 :
......
...@@ -43,8 +43,8 @@ void rtl92e_enable_hw_security_config(struct net_device *dev) ...@@ -43,8 +43,8 @@ void rtl92e_enable_hw_security_config(struct net_device *dev)
struct rtllib_device *ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
SECR_value = SCR_TxEncEnable | SCR_RxDecEnable; SECR_value = SCR_TxEncEnable | SCR_RxDecEnable;
if (((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || if (((ieee->pairwise_key_type == KEY_TYPE_WEP40) ||
(KEY_TYPE_WEP104 == ieee->pairwise_key_type)) && (ieee->pairwise_key_type == KEY_TYPE_WEP104)) &&
(priv->rtllib->auth_mode != 2)) { (priv->rtllib->auth_mode != 2)) {
SECR_value |= SCR_RxUseDK; SECR_value |= SCR_RxUseDK;
SECR_value |= SCR_TxUseDK; SECR_value |= SCR_TxUseDK;
......
...@@ -938,7 +938,7 @@ static int _rtl92e_wx_set_encode_ext(struct net_device *dev, ...@@ -938,7 +938,7 @@ static int _rtl92e_wx_set_encode_ext(struct net_device *dev,
idx--; idx--;
group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY; group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY;
if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || if ((!group) || (ieee->iw_mode == IW_MODE_ADHOC) ||
(alg == KEY_TYPE_WEP40)) { (alg == KEY_TYPE_WEP40)) {
if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40)) if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40))
alg = KEY_TYPE_WEP104; alg = KEY_TYPE_WEP104;
...@@ -1073,7 +1073,7 @@ static int _rtl92e_wx_set_promisc_mode(struct net_device *dev, ...@@ -1073,7 +1073,7 @@ static int _rtl92e_wx_set_promisc_mode(struct net_device *dev,
bPromiscuousOn = info_buf[1]; bPromiscuousOn = info_buf[1];
bFilterSourceStationFrame = info_buf[2]; bFilterSourceStationFrame = info_buf[2];
if (OID_RT_INTEL_PROMISCUOUS_MODE == oid) { if (oid == OID_RT_INTEL_PROMISCUOUS_MODE) {
ieee->IntelPromiscuousModeInfo.bPromiscuousOn = ieee->IntelPromiscuousModeInfo.bPromiscuousOn =
(bPromiscuousOn) ? (true) : (false); (bPromiscuousOn) ? (true) : (false);
ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame = ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame =
......
...@@ -113,7 +113,7 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst, ...@@ -113,7 +113,7 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,
*tag++ = type; *tag++ = type;
*tag++ = pBA->DialogToken; *tag++ = pBA->DialogToken;
if (ACT_ADDBARSP == type) { if (type == ACT_ADDBARSP) {
RT_TRACE(COMP_DBG, "====>to send ADDBARSP\n"); RT_TRACE(COMP_DBG, "====>to send ADDBARSP\n");
put_unaligned_le16(StatusCode, tag); put_unaligned_le16(StatusCode, tag);
...@@ -126,7 +126,7 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst, ...@@ -126,7 +126,7 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,
put_unaligned_le16(pBA->BaTimeoutValue, tag); put_unaligned_le16(pBA->BaTimeoutValue, tag);
tag += 2; tag += 2;
if (ACT_ADDBAREQ == type) { if (type == ACT_ADDBAREQ) {
memcpy(tag, (u8 *)&(pBA->BaStartSeqCtrl), 2); memcpy(tag, (u8 *)&(pBA->BaStartSeqCtrl), 2);
tag += 2; tag += 2;
} }
......
...@@ -1530,7 +1530,7 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, ...@@ -1530,7 +1530,7 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
{ {
int ret = 0; int ret = 0;
if ((NULL == ieee) || (NULL == skb) || (NULL == rx_stats)) { if (!ieee || !skb || !rx_stats) {
pr_info("%s: Input parameters NULL!\n", __func__); pr_info("%s: Input parameters NULL!\n", __func__);
goto rx_dropped; goto rx_dropped;
} }
...@@ -2554,7 +2554,7 @@ static inline int is_beacon(u16 fc) ...@@ -2554,7 +2554,7 @@ static inline int is_beacon(u16 fc)
static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel) static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel)
{ {
if (MAX_CHANNEL_NUMBER < channel) { if (channel > MAX_CHANNEL_NUMBER) {
netdev_info(rtllib->dev, "%s(): Invalid Channel\n", __func__); netdev_info(rtllib->dev, "%s(): Invalid Channel\n", __func__);
return 0; return 0;
} }
...@@ -2567,7 +2567,7 @@ static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel) ...@@ -2567,7 +2567,7 @@ static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel)
int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel) int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel)
{ {
if (MAX_CHANNEL_NUMBER < channel) { if (channel > MAX_CHANNEL_NUMBER) {
netdev_info(rtllib->dev, "%s(): Invalid Channel\n", __func__); netdev_info(rtllib->dev, "%s(): Invalid Channel\n", __func__);
return 0; return 0;
} }
......
...@@ -858,7 +858,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, ...@@ -858,7 +858,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee,
crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
encrypt = ieee->host_encrypt && crypt && crypt->ops && encrypt = ieee->host_encrypt && crypt && crypt->ops &&
((0 == strcmp(crypt->ops->name, "R-WEP") || wpa_ie_len)); ((strcmp(crypt->ops->name, "R-WEP") == 0 || wpa_ie_len));
if (ieee->pHTInfo->bCurrentHTSupport) { if (ieee->pHTInfo->bCurrentHTSupport) {
tmp_ht_cap_buf = (u8 *) &(ieee->pHTInfo->SelfHTCap); tmp_ht_cap_buf = (u8 *) &(ieee->pHTInfo->SelfHTCap);
tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap);
...@@ -1180,7 +1180,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, ...@@ -1180,7 +1180,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon,
crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
if (crypt != NULL) if (crypt != NULL)
encrypt = ieee->host_encrypt && crypt && crypt->ops && encrypt = ieee->host_encrypt && crypt && crypt->ops &&
((0 == strcmp(crypt->ops->name, "R-WEP") || ((strcmp(crypt->ops->name, "R-WEP") == 0 ||
wpa_ie_len)); wpa_ie_len));
else else
encrypt = 0; encrypt = 0;
...@@ -2229,7 +2229,7 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, ...@@ -2229,7 +2229,7 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb,
ieee->state == RTLLIB_ASSOCIATING_AUTHENTICATED && ieee->state == RTLLIB_ASSOCIATING_AUTHENTICATED &&
(ieee->iw_mode == IW_MODE_INFRA)) { (ieee->iw_mode == IW_MODE_INFRA)) {
errcode = assoc_parse(ieee, skb, &aid); errcode = assoc_parse(ieee, skb, &aid);
if (0 == errcode) { if (!errcode) {
struct rtllib_network *network = struct rtllib_network *network =
kzalloc(sizeof(struct rtllib_network), kzalloc(sizeof(struct rtllib_network),
GFP_ATOMIC); GFP_ATOMIC);
...@@ -3480,7 +3480,7 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee) ...@@ -3480,7 +3480,7 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee)
crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
encrypt = (ieee->current_network.capability & WLAN_CAPABILITY_PRIVACY) encrypt = (ieee->current_network.capability & WLAN_CAPABILITY_PRIVACY)
|| (ieee->host_encrypt && crypt && crypt->ops && || (ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "R-WEP"))); (strcmp(crypt->ops->name, "R-WEP") == 0));
/* simply judge */ /* simply judge */
if (encrypt && (wpa_ie_len == 0)) { if (encrypt && (wpa_ie_len == 0)) {
......
...@@ -635,10 +635,10 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -635,10 +635,10 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
} }
if (skb->len > 282) { if (skb->len > 282) {
if (ETH_P_IP == ether_type) { if (ether_type == ETH_P_IP) {
const struct iphdr *ip = (struct iphdr *) const struct iphdr *ip = (struct iphdr *)
((u8 *)skb->data+14); ((u8 *)skb->data+14);
if (IPPROTO_UDP == ip->protocol) { if (ip->protocol == IPPROTO_UDP) {
struct udphdr *udp; struct udphdr *udp;
udp = (struct udphdr *)((u8 *)ip + udp = (struct udphdr *)((u8 *)ip +
...@@ -651,7 +651,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -651,7 +651,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
ieee->LPSDelayCnt = 200; ieee->LPSDelayCnt = 200;
} }
} }
} else if (ETH_P_ARP == ether_type) { } else if (ether_type == ETH_P_ARP) {
netdev_info(ieee->dev, netdev_info(ieee->dev,
"=================>DHCP Protocol start tx ARP pkt!!\n"); "=================>DHCP Protocol start tx ARP pkt!!\n");
bdhcp = true; bdhcp = true;
......
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