Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4048363ybg; Fri, 25 Oct 2019 12:34:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVNeBtc42BM6uhSnTqEuahh3WbsQrEyCKRn14kgeePHO9kG7QtmOs+wwa8tdRbpD/Srp6u X-Received: by 2002:a17:906:5490:: with SMTP id r16mr5101123ejo.308.1572032049029; Fri, 25 Oct 2019 12:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572032049; cv=none; d=google.com; s=arc-20160816; b=hFMBbwz0Jb7oN+DjYdm5mL5ZOUDW0I9gTpGAGV5B8FGWFJAYlM8GhqfBm5KZ+zJp/J b7wKTk+8b1+J/p6IlKR9w0tE1OAj7hlh++DKdtkRmdwzq4TjCV2q7rlTWiMesMlzrlh6 trWTEd1oW6PrVFwc6bjz1v3+79eeEzL9yVANWUsZpe9kIzIS0A/14GS5wxWYpYNNH/Qh HryNiImkyhsFrpb/BxuLByYYawMMgjT1DsZ9trNw5/ZSelnzem/Xba4bpe4Us4JZSK9l aTfSRv69PuISqyLFAZzJFE9FhUqZEFV3dW6pI8mrlHEfSEou1zyMOOTTepKOGG8VA2Um yTcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=lsLsHd6T7dzyICzGkiSTXNN8IptVJw8nfM5qzCo0kW4=; b=DYhyqmRQ+LPEve4NljBLtLafwIEYXMeFDU4B1mU5bv6cOqabkEL8MyWldxFkT+abdX RBe9d7/QlNNBZN9d+CQJh93pEJDQjF/gGM66xnUucn2ZeqTzt4lV8keTfXGzq/bCqKdM MBkiTic9ed/OVa7ZE8SB9Na5zpLpfIFJLyD/TSMMTU4ujESRHac4HuWTMnzAzaaKfu1i /5+xjXZ/Icxvf20haBH6q7GIiOHn2aXYk1AgHThRMnYTnfRUpvjlplQlhfEtG7ybshAP Oo7fXvlmvEA9/EP565ag+Ih3SFNBV15MeQ9rmJYWWv+2MXHetPkTbKMPBpjaFDmTR3wi 9t3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q26si1863210ejz.43.2019.10.25.12.33.44; Fri, 25 Oct 2019 12:34:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393259AbfJYJd7 (ORCPT + 99 others); Fri, 25 Oct 2019 05:33:59 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:50466 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730205AbfJYJd6 (ORCPT ); Fri, 25 Oct 2019 05:33:58 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x9P9XoIs026483, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTITCASV01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x9P9XoIs026483 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 25 Oct 2019 17:33:50 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.468.0; Fri, 25 Oct 2019 17:33:50 +0800 From: To: CC: , , Subject: [PATCH 4/6] rtw88: rearrange if..else statements for rx rate indexes Date: Fri, 25 Oct 2019 17:33:43 +0800 Message-ID: <20191025093345.22643-5-yhchuang@realtek.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191025093345.22643-1-yhchuang@realtek.com> References: <20191025093345.22643-1-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang Driver just memset() rx_status to 0 before assigning rate indexes. And driver could never hit the 'else' because the driver checks if 'pkt_stat->rate >= DESC_RATEMCS0', so the 'else' statement can be removed. Also rearrange the if..else statements because DESC_RATEMCS0 is actually larger than DESC_RATE1M ~ DESC_RATE54M, move the check of 'pkt_stat->rate >= DESC_RATEMCS0' to the last to keep an increasing order. Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/rx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/rx.c b/drivers/net/wireless/realtek/rtw88/rx.c index 36887f998090..9b90339ab697 100644 --- a/drivers/net/wireless/realtek/rtw88/rx.c +++ b/drivers/net/wireless/realtek/rtw88/rx.c @@ -160,19 +160,17 @@ void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev, else if (pkt_stat->rate >= DESC_RATEMCS0) rx_status->encoding = RX_ENC_HT; - if (pkt_stat->rate >= DESC_RATEMCS0) { - rtw_desc_to_mcsrate(pkt_stat->rate, &rx_status->rate_idx, - &rx_status->nss); - } else if (rx_status->band == NL80211_BAND_5GHZ && - pkt_stat->rate >= DESC_RATE6M && - pkt_stat->rate <= DESC_RATE54M) { + if (rx_status->band == NL80211_BAND_5GHZ && + pkt_stat->rate >= DESC_RATE6M && + pkt_stat->rate <= DESC_RATE54M) { rx_status->rate_idx = pkt_stat->rate - DESC_RATE6M; } else if (rx_status->band == NL80211_BAND_2GHZ && pkt_stat->rate >= DESC_RATE1M && pkt_stat->rate <= DESC_RATE54M) { rx_status->rate_idx = pkt_stat->rate - DESC_RATE1M; - } else { - rx_status->rate_idx = 0; + } else if (pkt_stat->rate >= DESC_RATEMCS0) { + rtw_desc_to_mcsrate(pkt_stat->rate, &rx_status->rate_idx, + &rx_status->nss); } rx_status->flag |= RX_FLAG_MACTIME_START; -- 2.17.1