From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH 06/11] staging: rtl8192e: Remove variable host_encrypt as it is constant
Date: Sat, 24 Jun 2023 08:04:14 +0200 [thread overview]
Message-ID: <bc4ea0492306f708f0e5cac6bf0239deb3cd9a80.1687583718.git.philipp.g.hortmann@gmail.com> (raw)
In-Reply-To: <cover.1687583718.git.philipp.g.hortmann@gmail.com>
ieee->host_encrypt also named priv->rtllib->host_encrypt 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>
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 -
drivers/staging/rtl8192e/rtllib.h | 1 -
drivers/staging/rtl8192e/rtllib_module.c | 1 -
drivers/staging/rtl8192e/rtllib_softmac.c | 12 ++++--------
drivers/staging/rtl8192e/rtllib_tx.c | 3 +--
5 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index cb0753f6fb18..838b9c8b0df7 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -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_encrypt = 1;
priv->rtllib->host_decrypt = 1;
priv->rtllib->fts = DEFAULT_FRAG_THRESHOLD;
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index fdb7990130b5..80090f8a38e7 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1441,7 +1441,6 @@ struct rtllib_device {
*/
/* If the host performs {en,de}cryption, then set to 1 */
- int host_encrypt;
int host_decrypt;
int ieee802_1x; /* is IEEE 802.1X used */
diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c
index d6a4d6b4ec57..2ad2e3671ec4 100644
--- a/drivers/staging/rtl8192e/rtllib_module.c
+++ b/drivers/staging/rtl8192e/rtllib_module.c
@@ -98,7 +98,6 @@ struct net_device *alloc_rtllib(int sizeof_priv)
ieee->open_wep = 1;
/* Default to enabling full open WEP with host based encrypt/decrypt */
- ieee->host_encrypt = 1;
ieee->host_decrypt = 1;
ieee->ieee802_1x = 1; /* Default to supporting 802.1x */
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index c1e5127f5251..23b33a239703 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -807,7 +807,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee,
}
crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = crypt && crypt->ops &&
((strcmp(crypt->ops->name, "R-WEP") == 0 || wpa_ie_len));
if (ieee->ht_info->bCurrentHTSupport) {
tmp_ht_cap_buf = (u8 *)&(ieee->ht_info->SelfHTCap);
@@ -943,10 +943,7 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest)
assoc->capability |=
cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME);
- if (ieee->host_encrypt)
- crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
- else
- crypt = NULL;
+ crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
encrypt = (crypt && crypt->ops);
@@ -1115,7 +1112,7 @@ rtllib_association_req(struct rtllib_network *beacon,
crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
if (crypt != NULL)
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = crypt && crypt->ops &&
((strcmp(crypt->ops->name, "R-WEP") == 0 ||
wpa_ie_len));
else
@@ -2995,8 +2992,7 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee)
crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
encrypt = (ieee->current_network.capability & WLAN_CAPABILITY_PRIVACY)
- || (ieee->host_encrypt && crypt && crypt->ops &&
- (strcmp(crypt->ops->name, "R-WEP") == 0));
+ || (crypt && crypt->ops && (strcmp(crypt->ops->name, "R-WEP") == 0));
/* simply judge */
if (encrypt && (wpa_ie_len == 0)) {
diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c
index ec038ef806c3..24fd40284420 100644
--- a/drivers/staging/rtl8192e/rtllib_tx.c
+++ b/drivers/staging/rtl8192e/rtllib_tx.c
@@ -635,8 +635,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
skb->priority = rtllib_classify(skb, IsAmsdu);
crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
- encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
- ieee->host_encrypt && crypt && crypt->ops;
+ encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && crypt && crypt->ops;
if (!encrypt && ieee->ieee802_1x &&
ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
stats->tx_dropped++;
--
2.41.0
next prev parent reply other threads:[~2023-06-24 6:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-24 6:03 [PATCH 00/11] staging: rtl8192e: Remove timer function TsSetupTimeOut Philipp Hortmann
2023-06-24 6:03 ` [PATCH 01/11] staging: rtl8192e: Remove unused timer SetupTimer Philipp Hortmann
2023-06-24 6:03 ` [PATCH 02/11] staging: rtl8192e: Remove equation of local variable InactTime of AdmitTS Philipp Hortmann
2023-06-24 6:03 ` [PATCH 03/11] staging: rtl8192e: Remove unused timer InactTimer Philipp Hortmann
2023-06-24 6:03 ` [PATCH 04/11] staging: rtl8192e: Remove empty function AdmitTS Philipp Hortmann
2023-06-24 6:04 ` [PATCH 05/11] staging: rtl8192e: Remove variable modulation as it is constant Philipp Hortmann
2023-06-24 6:04 ` Philipp Hortmann [this message]
2023-06-24 6:04 ` [PATCH 07/11] staging: rtl8192e: Remove variable host_decrypt " Philipp Hortmann
2023-06-24 6:04 ` [PATCH 08/11] staging: rtl8192e: Remove variable card_type Philipp Hortmann
2023-06-24 6:04 ` [PATCH 09/11] staging: rtl8192e: Remove variable bdisable_nic Philipp Hortmann
2023-06-24 6:04 ` [PATCH 10/11] staging: rtl8192e: Remove variable priv->reg_chnl_plan Philipp Hortmann
2023-06-24 6:04 ` [PATCH 11/11] staging: rtl8192e: Remove variable ieee->short_slot Philipp Hortmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bc4ea0492306f708f0e5cac6bf0239deb3cd9a80.1687583718.git.philipp.g.hortmann@gmail.com \
--to=philipp.g.hortmann@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®