mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Martin Kaiser <martin@kaiser.cx>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Phillip Potter <phil@philpotter.co.uk>,
	Michael Straube <straube.linux@gmail.com>,
	Pavel Skripkin <paskripkin@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	Martin Kaiser <martin@kaiser.cx>
Subject: [PATCH 04/20] staging: r8188eu: return immediately if we're not meant to encrypt
Date: Fri, 30 Dec 2022 19:06:30 +0100	[thread overview]
Message-ID: <20221230180646.91008-5-martin@kaiser.cx> (raw)
In-Reply-To: <20221230180646.91008-1-martin@kaiser.cx>

In function xmitframe_swencrypt, we can return immediately if our packet
needs no encryption. This is simpler than wrapping all the code into a
large if statement.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_xmit.c | 31 +++++++++++++------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 4cd457cfb791..35d291d78c60 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -765,21 +765,22 @@ static void xmitframe_swencrypt(struct adapter *padapter, struct xmit_frame *pxm
 {
 	struct	pkt_attrib	 *pattrib = &pxmitframe->attrib;
 
-	if (pattrib->bswenc) {
-		switch (pattrib->encrypt) {
-		case _WEP40_:
-		case _WEP104_:
-			rtw_wep_encrypt(padapter, pxmitframe);
-			break;
-		case _TKIP_:
-			rtw_tkip_encrypt(padapter, pxmitframe);
-			break;
-		case _AES_:
-			rtw_aes_encrypt(padapter, pxmitframe);
-			break;
-		default:
-			break;
-		}
+	if (!pattrib->bswenc)
+		return;
+
+	switch (pattrib->encrypt) {
+	case _WEP40_:
+	case _WEP104_:
+		rtw_wep_encrypt(padapter, pxmitframe);
+		break;
+	case _TKIP_:
+		rtw_tkip_encrypt(padapter, pxmitframe);
+		break;
+	case _AES_:
+		rtw_aes_encrypt(padapter, pxmitframe);
+		break;
+	default:
+		break;
 	}
 }
 
-- 
2.30.2


  parent reply	other threads:[~2022-12-30 18:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30 18:06 [PATCH 00/20] staging: r8188eu: some xmit cleanups Martin Kaiser
2022-12-30 18:06 ` [PATCH 01/20] staging: r8188eu: make xmitframe_swencrypt a void function Martin Kaiser
2022-12-30 18:06 ` [PATCH 02/20] staging: r8188eu: remove some unused CAM defines Martin Kaiser
2022-12-30 18:06 ` [PATCH 03/20] staging: r8188eu: cmd_seq is write-only Martin Kaiser
2022-12-30 18:06 ` Martin Kaiser [this message]
2022-12-30 18:06 ` [PATCH 05/20] staging: r8188eu: remove unused parameter Martin Kaiser
2022-12-30 18:06 ` [PATCH 06/20] staging: r8188eu: simplify rtl8188eu_xmit_tasklet Martin Kaiser
2022-12-30 18:06 ` [PATCH 07/20] staging: r8188eu: remove rtl8188eu_init_xmit_priv Martin Kaiser
2022-12-30 18:06 ` [PATCH 08/20] staging: r8188eu: remove duplicate psta check Martin Kaiser
2022-12-30 18:06 ` [PATCH 09/20] staging: r8188eu: simplify frame type check Martin Kaiser
2022-12-30 18:06 ` [PATCH 10/20] staging: r8188eu: simplify rtw_make_wlanhdr's error handling Martin Kaiser
2022-12-30 18:06 ` [PATCH 11/20] staging: r8188eu: clean up qos_option setting Martin Kaiser
2022-12-30 18:06 ` [PATCH 12/20] staging: r8188eu: remove unused bpending array Martin Kaiser
2022-12-30 18:06 ` [PATCH 13/20] staging: r8188eu: remove unused dma_transfer_addr Martin Kaiser
2022-12-30 18:06 ` [PATCH 14/20] staging: r8188eu: bm_pending is not used Martin Kaiser
2022-12-30 18:06 ` [PATCH 15/20] staging: r8188eu: terminate_xmitthread_sema " Martin Kaiser
2022-12-30 18:06 ` [PATCH 16/20] staging: r8188eu: tx_retevt semaphore " Martin Kaiser
2022-12-30 18:06 ` [PATCH 17/20] staging: r8188eu: remove unnecessary rtw_free_xmitframe call Martin Kaiser
2022-12-30 18:06 ` [PATCH 18/20] staging: r8188eu: phwxmit parameter is unused Martin Kaiser
2022-12-30 18:06 ` [PATCH 19/20] staging: r8188eu: rtw_init_hwxmits is not needed Martin Kaiser
2022-12-30 18:06 ` [PATCH 20/20] staging: r8188eu: we use a constant number of hw_xmit entries Martin Kaiser
2023-01-17 18:33   ` Greg Kroah-Hartman
2022-12-31 10:08 ` [PATCH 00/20] staging: r8188eu: some xmit cleanups 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=20221230180646.91008-5-martin@kaiser.cx \
    --to=martin@kaiser.cx \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=paskripkin@gmail.com \
    --cc=phil@philpotter.co.uk \
    --cc=straube.linux@gmail.com \
    /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®