From patchwork Sat Nov 26 16:01:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 26268 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4707809wrr; Sat, 26 Nov 2022 08:04:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf64Bsm4ZK54wTkXSdyQ15b8/V1wc8bAhMANpLn1uL/rasecdFgcTuJPBQ2iZgToECm2PgWY X-Received: by 2002:a17:902:e809:b0:186:8518:6c95 with SMTP id u9-20020a170902e80900b0018685186c95mr24502922plg.149.1669478641431; Sat, 26 Nov 2022 08:04:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669478641; cv=none; d=google.com; s=arc-20160816; b=EHcT0TdSU/n7BBxkB6j15mnEr4ddVY1+w2egDNQcBTBu/Zc5Yd05jcSu3u6SbYYh+K eerr1OXWs/96XhZ7OKDnMBB6A+RSWs83taJ1A+UmkwZeh83wngMWywql2eHAdN4lpGMQ sIgL61Q1nateSFbS5KixXVCgMlAVM6etfueXLkTbptHvqk951OeT9lGUHlGRn4GyAiCG CYmlpHv/A63T9+PM2bMPo8vDNxuC3a/mt14ugjiQmsAqMfP456whqGGqm3+byTbjmLCC y4HHeOnw/70wLlgK/JdDxt84kDbbVqgmZYRAvJ6eVJ8QnltIwKKv1QXiowz0EKf5X0+r +/+g== 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=A0A0SHvSoIv0chB+0jYBCrTPGOsQtpeMgolenbhc0tI=; b=b9SJC26RmSrHUZGLU78WoNy4ZhykE/WklMx8xcUfX5iD82Qeg9Nv0GGaOhYwQuYMOc bzZx4VBxRrVu5q1p5W+hMG/V9H70C4p/YHSPLLqUyVLuX44E/nOFZvQCqzC7zS4IHbDL DvYsrKN6q0WG8vUW4nqcoIeIj0p3JjR7XPUn3S1QiuTW8ZLBl0fanbzA5ePnjuwb67ta oVREqqmjug5BlSfwxAeh/WAxKRraAc2qjOmyL54QXTrgEHOgIphUGEjZyJeth0I/8ReZ nrKAYay+SATeOA8tQd4dxB9Y+Q3YQaQPTghZXlsBFOzGM0r9GVjRtLIOVL7vG1Gdd1of D1Yw== 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 d24-20020a17090ac25800b00212fb7e54ddsi6405883pjx.81.2022.11.26.08.03.48; Sat, 26 Nov 2022 08:04:01 -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 S229624AbiKZQCJ (ORCPT + 99 others); Sat, 26 Nov 2022 11:02:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiKZQBr (ORCPT ); Sat, 26 Nov 2022 11:01:47 -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 3E635193F8 for ; Sat, 26 Nov 2022 08:01:46 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxca-0000Ub-Q7; Sat, 26 Nov 2022 17:01:40 +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 09/10] staging: r8188eu: simplify error handling for missing station Date: Sat, 26 Nov 2022 17:01:28 +0100 Message-Id: <20221126160129.178697-10-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-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?1750575236154870461?= X-GMAIL-MSGID: =?utf-8?q?1750575236154870461?= Simplify the code to handle the case where we're associated to a station that is not in our list of known stations. We can simply exit in this case. This patch reverts the if-condition and saves one level of indentation. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 76424bcba416..362313c49c52 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -597,19 +597,19 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame) if (((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE) && (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) { psta = rtw_get_stainfo(pstapriv, mgmt->sa); - if (psta) { - ret = rtw_check_bcn_info(padapter, pframe, len); - if (!ret) { - receive_disconnect(padapter, - pmlmeinfo->network.MacAddress, 0); - return; - } - /* update WMM, ERP in the beacon */ - /* todo: the timer is used instead of the number of the beacon received */ - if ((sta_rx_pkts(psta) & 0xf) == 0) - update_beacon_info(padapter, ie_ptr, ie_len, psta); - process_p2p_ps_ie(padapter, ie_ptr, ie_len); + if (!psta) + return; + + ret = rtw_check_bcn_info(padapter, pframe, len); + if (!ret) { + receive_disconnect(padapter, pmlmeinfo->network.MacAddress, 0); + return; } + /* update WMM, ERP in the beacon */ + /* todo: the timer is used instead of the number of the beacon received */ + if ((sta_rx_pkts(psta) & 0xf) == 0) + update_beacon_info(padapter, ie_ptr, ie_len, psta); + process_p2p_ps_ie(padapter, ie_ptr, ie_len); } else if ((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE) { psta = rtw_get_stainfo(pstapriv, mgmt->sa); if (psta) {