Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp12453976rwb; Sat, 26 Nov 2022 09:15:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf5HkQmfwYqIt81ovo4CxATtE8H+Ntjp4TkvnZzO1Folei+X1zgnukU55QOiQHjROsp6Z8Ae X-Received: by 2002:a17:902:d2c7:b0:189:d3b:61fe with SMTP id n7-20020a170902d2c700b001890d3b61femr23999104plc.168.1669482925688; Sat, 26 Nov 2022 09:15:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669482925; cv=none; d=google.com; s=arc-20160816; b=ItWKJb7LXnq5iRYA0vm/vdTTsWNApwzEdManP3/srOIjzYLKIPpiPhnhcz2vH3LJ32 S2IDU/0V7OMYsR5bNTRFC+q5UVv7cGqbfoGOl8xobOFPbV+1xQHNDnfJxlrjliK/RtHV mG2n3rsfNCvB5DFs+abfPPONRHQtUHGM11lL5ScC9LL1akLj1g68IR4rLcyichQGpwrv ltTxywhGglM5DWmeokM6Q6e8QhOVgl/ra/n17P/cemoPufIO7lGGHRBWc/iMP/sbMhxA Xk5KLi53Ys0w6xMfnRhVHxoGVdnx+ptSXEjyOkthqzMZjd+lai3JVce1y6LXyKkYCweO H6MQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a17090a67c800b002190ba4112dsi4610203pjm.94.2022.11.26.09.15.13; Sat, 26 Nov 2022 09:15:25 -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 + 84 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 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 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) { -- 2.30.2