staging: rtl8192u: ieee80211: ieee80211_crypt_tkip.c: Replace bit shifting with BIT...
authorPayal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
Tue, 2 Apr 2019 13:28:34 +0000 (18:58 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Apr 2019 17:57:11 +0000 (19:57 +0200)
Challenge suggested by coccinelle.
Prefer using BIT and replace bit shifting with the BIT(x) macro.

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c

index 829fa4b..320c179 100644 (file)
@@ -331,7 +331,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
                *pos++ = rc4key[2];
        }
 
-       *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */;
+       *pos++ = (tkey->key_idx << 6) | BIT(5) /* Ext IV included */;
        *pos++ = tkey->tx_iv32 & 0xff;
        *pos++ = (tkey->tx_iv32 >> 8) & 0xff;
        *pos++ = (tkey->tx_iv32 >> 16) & 0xff;
@@ -390,7 +390,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
        hdr = (struct rtl_80211_hdr_4addr *) skb->data;
        pos = skb->data + hdr_len;
        keyidx = pos[3];
-       if (!(keyidx & (1 << 5))) {
+       if (!(keyidx & BIT(5))) {
                if (net_ratelimit()) {
                        printk(KERN_DEBUG "TKIP: received packet without ExtIV"
                               " flag from %pM\n", hdr->addr2);