Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1437162rwb; Tue, 29 Nov 2022 13:38:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf7t60x9XGb6UD8LXDi1UKDrYVNZzWaj3PhlplS/e1ror925C8i8qCf8CwZiGL5d3IabPFri X-Received: by 2002:a17:90b:3941:b0:215:db2e:bb17 with SMTP id oe1-20020a17090b394100b00215db2ebb17mr61857604pjb.166.1669757909253; Tue, 29 Nov 2022 13:38:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669757909; cv=none; d=google.com; s=arc-20160816; b=qnbSX+O8RH1K0kdU69Oler8JiWoO/FczBMkjhXY2E9L+BmL2HpguIIfrmWijzLekTc trMTCBNNJduIUMqbDrV7YZMiu9v058AyavMKgb+qtkfypj+Sn+92Tpdxb10m/FdOyTNd /WARvINdXXriQt6FmeuA7nyOYR9aNj62sIN5P+TMCtOmy4GdbqIYytiaAIJHzFa4mC3y SNR/mf1f/oHUmGT6hRX6L59eh5E3g98P3ZO5RkLDg+zGyNT9ymSzaBdai/+sDZ7kCngq MTpKw4uq42Rrw7KK2ldp7PFA4fUTAgDxsVCOrjQWp0WlWarr0/BJ8fFWX6bJs6/u9JcB T87g== 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=BNA1E/NA02d1ETmTBkm/Ggf9scxIq2GGBJ6E/n0Vc4c=; b=jOcu+8Kb65JHnIKH3+k4Ib/+Qrw+ZdrDojXCdrLhST4Yd3m/iSekw3VuGej3JCWJOU j6xN+5cg6Vr4ayY0dDPnXi06HhlClAYA9ZVTZaJkP881znTVwCLHx3cBFSYee0fh67KX kybYVHKxH+zsbPydQAqLVzhe5XFypBTEBPw66Vq/ityWLg3rJjeRRUhlB/j/CdIH1Bzv 3gQMLNbYdz1uyxYlO/XGbFiciqv7knre7Xly6vHzk8ZaCIwfqzWIMbtP7dn66op5JM7y bX38H9ap1RSlZdBuX6ffDu57NvxogAyMAsE8H8iOY7zyWJfEhOAcN57cgSCKIRkMSL++ OyrQ== 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 k16-20020a63f010000000b0047701022c7dsi16962081pgh.729.2022.11.29.13.38.18; Tue, 29 Nov 2022 13:38:29 -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 S236689AbiK2Uwb (ORCPT + 84 others); Tue, 29 Nov 2022 15:52:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236509AbiK2UwX (ORCPT ); Tue, 29 Nov 2022 15:52:23 -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 8C29B5FE7 for ; Tue, 29 Nov 2022 12:52:22 -0800 (PST) Received: from dslb-188-104-061-001.188.104.pools.vodafone-ip.de ([188.104.61.1] 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 1p07aT-0001pO-0u; Tue, 29 Nov 2022 21:52:17 +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 4/5] staging: r8188eu: handle the non-ap case first Date: Tue, 29 Nov 2022 21:51:51 +0100 Message-Id: <20221129205152.128172-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221129205152.128172-1-martin@kaiser.cx> References: <20221129205152.128172-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 The OnDisassoc function hasn't got much to do if we're not working as an access point. Move this case out of the large if statement to simplify the code. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 36 ++++++++++----------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index dd1e0b4fc5a0..d5c9eb52fb0e 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1433,6 +1433,8 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wifidirect_info *pwdinfo = &padapter->wdinfo; + struct sta_info *psta; + struct sta_priv *pstapriv = &padapter->stapriv; if (memcmp(mgmt->bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) return; @@ -1444,29 +1446,25 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) reason = le16_to_cpu(mgmt->u.disassoc.reason_code); - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - struct sta_info *psta; - struct sta_priv *pstapriv = &padapter->stapriv; - - psta = rtw_get_stainfo(pstapriv, mgmt->sa); - if (psta) { - u8 updated = 0; + if (!check_fwstate(pmlmepriv, WIFI_AP_STATE)) { + receive_disconnect(padapter, mgmt->bssid, reason); + pmlmepriv->LinkDetectInfo.bBusyTraffic = false; + return; + } - spin_lock_bh(&pstapriv->asoc_list_lock); - if (!list_empty(&psta->asoc_list)) { - list_del_init(&psta->asoc_list); - pstapriv->asoc_list_cnt--; - updated = ap_free_sta(padapter, psta, false, reason); - } - spin_unlock_bh(&pstapriv->asoc_list_lock); + psta = rtw_get_stainfo(pstapriv, mgmt->sa); + if (psta) { + u8 updated = 0; - associated_clients_update(padapter, updated); + spin_lock_bh(&pstapriv->asoc_list_lock); + if (!list_empty(&psta->asoc_list)) { + list_del_init(&psta->asoc_list); + pstapriv->asoc_list_cnt--; + updated = ap_free_sta(padapter, psta, false, reason); } + spin_unlock_bh(&pstapriv->asoc_list_lock); - return; - } else { - receive_disconnect(padapter, mgmt->bssid, reason); - pmlmepriv->LinkDetectInfo.bBusyTraffic = false; + associated_clients_update(padapter, updated); } } -- 2.30.2