From patchwork Fri Dec 30 18:06:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 37732 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3008367wrt; Fri, 30 Dec 2022 10:08:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXt21nJ1lQyZ2v8qyb8yymdSb4d0+Fs6cwaWrV0FBDywcolxMDhAELMUjtlahGKUBWBHx0EI X-Received: by 2002:a17:90a:b78b:b0:223:9b0d:15ab with SMTP id m11-20020a17090ab78b00b002239b0d15abmr38316703pjr.12.1672423691048; Fri, 30 Dec 2022 10:08:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672423691; cv=none; d=google.com; s=arc-20160816; b=aFvR06uRd6ml+0ybKZw1xQ3LU6hvrvrw7YbkUs8GYY+L3APiTSrWoWtEHC2Eug4eJ1 v/au6cgnxzTGd6OLeENfGfJ7MLsc4ubglOnr0JAkdzCUPKngSnFYdtpqTpxvUykquWxv a3nqSbK0shY4wjKMOm6C06/wkgfD1sWakZNIhBOmC5ZgeydYf6MkwLKJ2+7mB560iyue WiQ+ypWwh3q2PPXlDVFziJvpmw1fDEZSlQEF4WwqzGBET8D/sCOkJnvM+S2MQ92SsyR5 HEFRC5h3U2r4E4DLe3f6sA8D2RB3cdLj04M0LaPoxDEZkCYxwkjByqvvKFrxIZNLat6Q u1MA== 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 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.07.59; Fri, 30 Dec 2022 10:08:11 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753663344213659274?= X-GMAIL-MSGID: =?utf-8?q?1753663344213659274?= 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; } }