staging: rtl8192e: Remove variable host_decrypt as it is constant
authorPhilipp Hortmann <philipp.g.hortmann@gmail.com>
Sat, 24 Jun 2023 06:04:20 +0000 (08:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jul 2023 07:57:38 +0000 (09:57 +0200)
ieee->host_decrypt also named priv->rtllib->host_decrypt is initialized
to 1 and then unchanged. All evaluations will result accordingly. Remove
resulting dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/637350e9bc3edded665009a30d12350157e8a9a9.1687583718.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtl8192e/rtl_core.c
drivers/staging/rtl8192e/rtllib.h
drivers/staging/rtl8192e/rtllib_module.c
drivers/staging/rtl8192e/rtllib_rx.c

index 838b9c8b0df7bae1701ccefbbeedb0e170accf6f..2f504a4838a8b67157e1fa0a94278af9e85f3811 100644 (file)
@@ -804,7 +804,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
        priv->rtllib->iw_mode = IW_MODE_INFRA;
        priv->rtllib->active_scan = 1;
        priv->rtllib->be_scan_inprogress = false;
-       priv->rtllib->host_decrypt = 1;
 
        priv->rtllib->fts = DEFAULT_FRAG_THRESHOLD;
 
index 80090f8a38e754278421f610855f0132aede4507..c7f800a0c48c8db4b08c91c8777c3e7a3852f9e7 100644 (file)
@@ -1440,9 +1440,6 @@ struct rtllib_device {
                                 * WEP key changes
                                 */
 
-       /* If the host performs {en,de}cryption, then set to 1 */
-       int host_decrypt;
-
        int ieee802_1x; /* is IEEE 802.1X used */
 
        /* WPA data */
index 2ad2e3671ec469774a1ab0231b59a74f57261b90..2416e0c602554df690e75f429246a651b4bbb180 100644 (file)
@@ -97,8 +97,6 @@ struct net_device *alloc_rtllib(int sizeof_priv)
        ieee->scan_age = DEFAULT_MAX_SCAN_AGE;
        ieee->open_wep = 1;
 
-       /* Default to enabling full open WEP with host based encrypt/decrypt */
-       ieee->host_decrypt = 1;
        ieee->ieee802_1x = 1; /* Default to supporting 802.1x */
 
        ieee->rtllib_ap_sec_type = rtllib_ap_sec_type;
index 91dd3c373aefc548ec44600fb6133040b5162c0c..195ce0fecd29466296b6329a2dd224b100b5fc69 100644 (file)
@@ -1035,29 +1035,27 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb,
        u16 fc = le16_to_cpu(hdr->frame_ctl);
        int idx = 0;
 
-       if (ieee->host_decrypt) {
-               if (skb->len >= hdrlen + 3)
-                       idx = skb->data[hdrlen + 3] >> 6;
+       if (skb->len >= hdrlen + 3)
+               idx = skb->data[hdrlen + 3] >> 6;
 
-               *crypt = ieee->crypt_info.crypt[idx];
-               /* allow NULL decrypt to indicate an station specific override
-                * for default encryption
+       *crypt = ieee->crypt_info.crypt[idx];
+       /* allow NULL decrypt to indicate an station specific override
+        * for default encryption
+        */
+       if (*crypt && ((*crypt)->ops == NULL ||
+                     (*crypt)->ops->decrypt_mpdu == NULL))
+               *crypt = NULL;
+
+       if (!*crypt && (fc & RTLLIB_FCTL_WEP)) {
+               /* This seems to be triggered by some (multicast?)
+                * frames from other than current BSS, so just drop the
+                * frames silently instead of filling system log with
+                * these reports.
                 */
-               if (*crypt && ((*crypt)->ops == NULL ||
-                             (*crypt)->ops->decrypt_mpdu == NULL))
-                       *crypt = NULL;
-
-               if (!*crypt && (fc & RTLLIB_FCTL_WEP)) {
-                       /* This seems to be triggered by some (multicast?)
-                        * frames from other than current BSS, so just drop the
-                        * frames silently instead of filling system log with
-                        * these reports.
-                        */
-                       netdev_dbg(ieee->dev,
-                                  "Decryption failed (not set) (SA= %pM)\n",
-                                  hdr->addr2);
-                       return -1;
-               }
+               netdev_dbg(ieee->dev,
+                          "Decryption failed (not set) (SA= %pM)\n",
+                          hdr->addr2);
+               return -1;
        }
 
        return 0;
@@ -1083,7 +1081,7 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
                ieee->need_sw_enc = 0;
 
        keyidx = rtllib_rx_frame_decrypt(ieee, skb, crypt);
-       if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && (keyidx < 0)) {
+       if ((fc & RTLLIB_FCTL_WEP) && (keyidx < 0)) {
                netdev_info(ieee->dev, "%s: decrypt frame error\n", __func__);
                return -1;
        }
@@ -1147,7 +1145,7 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
        /* skb: hdr + (possible reassembled) full MSDU payload; possibly still
         * encrypted/authenticated
         */
-       if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) &&
+       if ((fc & RTLLIB_FCTL_WEP) &&
                rtllib_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) {
                netdev_info(ieee->dev, "%s: ==>decrypt msdu error\n", __func__);
                return -1;