From patchwork Fri Dec 30 18:06:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 37735 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3008431wrt; Fri, 30 Dec 2022 10:08:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXtt1U4FZUSSzRSr2oL4tu5veaCvo4LFo6QZgaY5jOFgE78iDzwkTl/1Co+TSM4uQWVH9crW X-Received: by 2002:a05:6a20:4985:b0:ac:a2bb:96e6 with SMTP id fs5-20020a056a20498500b000aca2bb96e6mr34176118pzb.56.1672423701991; Fri, 30 Dec 2022 10:08:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672423701; cv=none; d=google.com; s=arc-20160816; b=w2EWIe84MoJ+B1ORJzHn4h3DVMOLtCSNOF/yQ16+0vUMcDCgNHjdFYyvm595E1v8Mj fdZ018gJtGnJqD0VbgaYCjRqHJN9WcJtZE7S7FoKcj0OheoVDny12lXtSaiSa5mYrnoI +N1/9QOBsG4lF5sGQBPR7gvUXQID42X2efVYp/H/QoU5uG+1b1W262hpaPW4/pBoS/iI u3u4LsV/AdFIhbcFhU9EY9cTI6t2a/K4kaJWG6iKY3dsTMpIxMXvQ4S5YHDzpBHKQ8LH BW4RLIbaflDW8kSPS1847T/V6lCn1RGWiYaCaUi1XiLNuQekDXID0NIpRxUkmQbX5kIX ZjPA== 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=9riakcnRMBIWTC6w3yfgBcitUX8iJe1gQ0Q4SMsO3xA=; b=qiVrznnk5rqS4lUO8X7ssacDRRSHix/wMwxCWWDZyJOInKKoIwRtakwp+XMUmDWYRy 03o5AOQxvXknV3fAfZ4xSogeYOvynHqOP46t413cfhdzuAuT9KkD4SN+G1GUHMiX/qxY ygzScQVV5kGwPfCo2uTxesvTf9JvkA+RWVuRrHEesMrxmNvOLfVi1FYTVK8qRKgH/Ntw 7BiLnYdbyH4SFGcjMpXTzukWe8+f+FLO8zsGQy0qdKBrTA2aLMXXmkXRhe8Kz77/mqn1 DlYSpgZHKq+EgBDZQW7E1lHWF/K+yKf8Mu/ryLMuJn/pCwxomIFub+Hms1lgAFAUVvmb RhkQ== 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 11-20020a63050b000000b00477aeffa74fsi13482855pgf.107.2022.12.30.10.08.10; Fri, 30 Dec 2022 10:08:21 -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 S235491AbiL3SHj (ORCPT + 99 others); Fri, 30 Dec 2022 13:07:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235436AbiL3SHU (ORCPT ); Fri, 30 Dec 2022 13:07:20 -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 C3BDC1C424 for ; Fri, 30 Dec 2022 10:07:16 -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 1pBJmi-0004rR-BI; Fri, 30 Dec 2022 19:07:12 +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 08/20] staging: r8188eu: remove duplicate psta check Date: Fri, 30 Dec 2022 19:06:34 +0100 Message-Id: <20221230180646.91008-9-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?1753663355657769569?= X-GMAIL-MSGID: =?utf-8?q?1753663355657769569?= We do not need the psta check in the while loop of rtw_xmitframe_coalesce. psta is already checked near the start of the function and is not modified afterwards. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_xmit.c | 36 ++++++++++++------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index 62b66a205a06..2bccb9ca42e9 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -1009,25 +1009,23 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct /* adding icv, if necessary... */ if (pattrib->iv_len) { - if (psta) { - switch (pattrib->encrypt) { - case _WEP40_: - case _WEP104_: - WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); - break; - case _TKIP_: - if (bmcst) - TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); - else - TKIP_IV(pattrib->iv, psta->dot11txpn, 0); - break; - case _AES_: - if (bmcst) - AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); - else - AES_IV(pattrib->iv, psta->dot11txpn, 0); - break; - } + switch (pattrib->encrypt) { + case _WEP40_: + case _WEP104_: + WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); + break; + case _TKIP_: + if (bmcst) + TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); + else + TKIP_IV(pattrib->iv, psta->dot11txpn, 0); + break; + case _AES_: + if (bmcst) + AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); + else + AES_IV(pattrib->iv, psta->dot11txpn, 0); + break; } memcpy(pframe, pattrib->iv, pattrib->iv_len);