Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7555637rwl; Fri, 30 Dec 2022 10:08:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXsA/DzUBrZh40Go5ceQfsabBbKW05GF9FOnBiVwEjdx2D1oedwzyu5O/iV7pD9homLyCmeU X-Received: by 2002:a17:90a:a597:b0:226:587:7911 with SMTP id b23-20020a17090aa59700b0022605877911mr15396059pjq.20.1672423724045; Fri, 30 Dec 2022 10:08:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672423724; cv=none; d=google.com; s=arc-20160816; b=nfYeW4OAJWQbjBC8G0dXgkmAx4peTi54788NL+TmyM6MW5a4V0q1lQT7zj5dmy3e2N E2RcpCq8uUXd/sEwX7bNo5pFay8uKfvAVqzRrPqHAbKPvA3jTUmPMhzi/oMuIJQNcBJa AjCgw29MHv78d0uVGALehissb/XLmqvaXThoAxvfncU/jOHFqFTauWa+LN8xP0TzRI2w PrVIK1UX3H85hgneDri+bMB1fq7oKgJ/6tPN7DzRnC25z5lVOF7hdmgdwbBlciEfOr2r iHty2HvGY8I41UxE875+ZlCPRiabgB1OOSwP4+ZdSp92jLSEMcX4YT6A2H7RswI+ZEo2 2VCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=h0FQPOUDjCyQNi3QfURkQUvZNbXTtDGRx5NYoaVxhf0=; b=zYdCyxFHAtUouqfi2VjurlSKNGPgrPaPrmgHl3X+ri36czr60DfTPL5Z5jfGl+05Dq pu1RUH87j9+BRV8lX66bidQwRbe9wGStwWHb53fOua5Pnfj7hbZYnLyIloIWK3Km8/o2 qx3RynJuBSD0IWdwyfQK1ntNUfFEnsZC+qD8l3m8RgPP2IydnxRvUDTOKQJKHT7goA4E ZQ1EUIkyoe+LU0av5J6UBEwIHCpBU7+s1pQtDb8C9CDKsW2iXM3V/DPtRXuNYLHlitPT 2AjtFQcWkTJ5Dl+iGWaZYtO6G4GMCJ088vS1qf/csrNx9vJU1QFGzxrmhB3dHqe0zVBm f61A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15-20020a63d60f000000b004774a855375si21757613pgg.351.2022.12.30.10.08.35; Fri, 30 Dec 2022 10:08:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235471AbiL3SHa (ORCPT + 63 others); Fri, 30 Dec 2022 13:07:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235422AbiL3SHQ (ORCPT ); Fri, 30 Dec 2022 13:07:16 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 452796248 for ; Fri, 30 Dec 2022 10:07:15 -0800 (PST) Received: from dslb-188-097-208-179.188.097.pools.vodafone-ip.de ([188.97.208.179] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1pBJmf-0004rR-6C; Fri, 30 Dec 2022 19:07:09 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 04/20] staging: r8188eu: return immediately if we're not meant to encrypt Date: Fri, 30 Dec 2022 19:06:30 +0100 Message-Id: <20221230180646.91008-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221230180646.91008-1-martin@kaiser.cx> References: <20221230180646.91008-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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