From patchwork Sun Oct 30 17:33:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13024 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1894029wru; Sun, 30 Oct 2022 10:35:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Wh9PMsfYjSBKpB/ErclINxDvx9RleoQe6DVVbXFPhf1qU3y+q26vBbtvsCM0MaZkTnQ1S X-Received: by 2002:a05:6402:378c:b0:458:8053:6c5f with SMTP id et12-20020a056402378c00b0045880536c5fmr9547863edb.9.1667151357215; Sun, 30 Oct 2022 10:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667151357; cv=none; d=google.com; s=arc-20160816; b=zrB/HWCJqTrnJDhap7YZ7JP9vdT/Q/vlBtfec5Uf7pNraE7iZZ+Yks64a25nK7jsv3 O49Cg1b3waFhTRErPj+pBPKJaKdDIPlaqhKw9MlGP/JolUhsQGfXprIvkTQ34pdtHi/d izEpnN0jtDnrYAze2rD8HZpXVOqcL+VXXYkjM+9AVN+FPoTewLebS3fPfzV+5CsVRNBA ZlMLPE4n65+08FLjv1GUy/Myd2vHhToHrFXLXRX37WLowWDKhEew6hcjdXblWkqFcTWS DZOF2+5x5q2Z3Mpdp/B0+6byLbFWXES5BTksnQARrqHSqj9+XCK06+622ViTNUhoqTTx U8uA== 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=Kt0K3G/Hsly6nqngiKMVj6xeO4zPe8E1y/y5D4Pkpek=; b=QRm2Olc5jBTVGBElWGvBYru8L0vQa+Lj/IC6kzZNmLI3RVRcjGvOvsvKtb+fAvB15x +wK+MexpaHb4lW+pdMB6PA168J7rfaa53Bodoq+UdMMUdCFlpnw/1BNmrzHx6sUMupSA 7OE0An8RDydIpn9zpkgnPoOCRaT0VVO8LvgPmay8NBETiZtWtV9Gi1bFHvMaXyDavIeS y/xgbRCqgKJ7nZrMnBcgUmEEcuYoI5KVL/qvRGa7wNJe25X9F6KygBoQ6gZgkAVSQaUC X7yHeMImblViuxfGpmQKG2+7LlK4znffWKgDoJ3F0HgshEMf9eCHONnSixUXjPjVimio y2Zw== 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 sb27-20020a1709076d9b00b0073866c0672asi6032561ejc.73.2022.10.30.10.35.33; Sun, 30 Oct 2022 10:35:57 -0700 (PDT) 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 S229961AbiJ3ReS (ORCPT + 99 others); Sun, 30 Oct 2022 13:34:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbiJ3Rdw (ORCPT ); Sun, 30 Oct 2022 13:33:52 -0400 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 DE9A59FC8 for ; Sun, 30 Oct 2022 10:33:51 -0700 (PDT) Received: from ipservice-092-217-067-184.092.217.pools.vodafone-ip.de ([92.217.67.184] 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 1opCBv-000469-UZ; Sun, 30 Oct 2022 18:33:48 +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 v2 09/13] staging: r8188eu: clean up on_action_public Date: Sun, 30 Oct 2022 18:33:22 +0100 Message-Id: <20221030173326.1588647-10-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221030173326.1588647-1-martin@kaiser.cx> References: <20221030173326.1588647-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?1748134901545062162?= X-GMAIL-MSGID: =?utf-8?q?1748134901545062162?= Use the struct mgmt to read the action_code. This is much simpler than parsing the message ourselves. Add a comment about reading the action code. All members of the action enum start with an action_code byte. It does not matter which member we use. Signed-off-by: Martin Kaiser --- Changes in v2 - don't remove the ret variable, it's already gone drivers/staging/r8188eu/core/rtw_mlme_ext.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 6d95d3bc23e6..b3cef3504ad3 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3813,23 +3813,16 @@ static unsigned int on_action_public_default(struct recv_frame *precv_frame) static void on_action_public(struct adapter *padapter, struct recv_frame *precv_frame) { struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; - u8 *pframe = precv_frame->rx_data; - u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr); - u8 action; /* check RA matches or not */ if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN)) return; - action = frame_body[1]; - switch (action) { - case ACT_PUBLIC_VENDOR: + /* All members of the action enum start with action_code. */ + if (mgmt->u.action.u.s1g.action_code == WLAN_PUB_ACTION_VENDOR_SPECIFIC) on_action_public_vendor(precv_frame); - break; - default: + else on_action_public_default(precv_frame); - break; - } } static void OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame)