Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2181398ybh; Fri, 13 Mar 2020 14:24:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsUhOsgXEErFsUQdlSGmkqCJCVlQGno9RLsoK7Ery51ACwudW944QNuse3wQhmlgDSEbpFa X-Received: by 2002:aca:3857:: with SMTP id f84mr8229126oia.150.1584134662913; Fri, 13 Mar 2020 14:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584134662; cv=none; d=google.com; s=arc-20160816; b=sX3blcYISc2jVSw2Y09nWPIBFBtp7VBA3vqLHwc27RjDvyKK2Av8RbmAeIlIi+no7c YFtdPtmjIXpRIxoFqFqAEzJAiVFmOferuqWVNtYOMcR3smbprvlb6qm/J114nQPbJ3AP Y6dhKEI2stnHgcpLm0pKhK1oRHqdvjMnRWnvTNDfs3tsPnNWz+jKYMKXfmtnl+zPW9cm TMlqC3zRAAu9IaCN/PnefQmFFllUITiKbK7gUiz9xxAoKdRxnSO+sfN8r6aPzUas63VS rndc2WyVJzre0IZgbeqFErLqAdD9uYjd7egvGo4w9LKvsN9joQjX2UQ+UbY2CaIsTFLG PivA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id; bh=OmqvoodscrGQC6WK/zTEif0AaFiJeX2fWz1crSsuRsE=; b=Mg+6QGcNj0fijXbXORDcL8ZQ154qbBDVygeewotVc0QCrFpwkgNCMadx6A/vuowfLV nXrgFiLEMD+jjLI2VsYVG7xaay86n2jbXYHSV4VaSc5oJ2U0age8iBztX8vtkv1fX4fB wr6rWB/PqaZEmDv3PYFXdM1WxziGXOjTVnYSsfz9IOUAwmv7OKOQ9CUWAZjsXmjnd6oz +R8q2Vff0HbQvLdbHCL+vE7O6RjdVl+ubA0PUqnZh7GRVBlitxPrRflxHPtDlwlMNwBg RxfkJznPc4KmbZsw5RMftu6yTS6B6Y1tTuzp5JUyKtc8z0qT1Rzg+JAdUvuu+oPHMBQ7 600w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 x79si4864788oif.180.2020.03.13.14.24.10; Fri, 13 Mar 2020 14:24:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727464AbgCMVXn (ORCPT + 99 others); Fri, 13 Mar 2020 17:23:43 -0400 Received: from smtprelay0073.hostedemail.com ([216.40.44.73]:47840 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726534AbgCMVXn (ORCPT ); Fri, 13 Mar 2020 17:23:43 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 42BE018017528; Fri, 13 Mar 2020 21:23:42 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:355:379:599:968:988:989:1260:1277:1311:1313:1314:1345:1359:1381:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2729:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3871:3872:4225:4250:4321:5007:7903:10004:10400:10848:11026:11232:11657:11658:11914:12043:12048:12297:12679:12740:12760:12895:13069:13255:13311:13357:13439:13972:14096:14097:14659:14721:21080:21627:21990:30054:30056:30070:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: magic84_5a52c2e86bc2d X-Filterd-Recvd-Size: 2535 Received: from XPS-9350.home (unknown [47.151.143.254]) (Authenticated sender: joe@perches.com) by omf11.hostedemail.com (Postfix) with ESMTPA; Fri, 13 Mar 2020 21:23:40 +0000 (UTC) Message-ID: <25a1aca2c993ecb70ba7cd9c9e38bce9170a98b0.camel@perches.com> Subject: Re: [Outreachy kernel] [PATCH v2] Staging: rtl8723bs: rtw_mlme: Remove unnecessary conditions From: Joe Perches To: Shreeya Patel , gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com, sbrivio@redhat.com, daniel.baluta@gmail.com, nramas@linux.microsoft.com, hverkuil@xs4all.nl, Larry.Finger@lwfinger.net Date: Fri, 13 Mar 2020 14:21:57 -0700 In-Reply-To: <20200313102912.17218-1-shreeya.patel23498@gmail.com> References: <20200313102912.17218-1-shreeya.patel23498@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-03-13 at 15:59 +0530, Shreeya Patel wrote: > Remove unnecessary if and else conditions since both are leading to the > initialization of "phtpriv->ampdu_enable" with the same value. > Also, remove the unnecessary else-if condition since it does nothing. [] > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c [] > @@ -2772,16 +2772,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len, u8 channe > > /* maybe needs check if ap supports rx ampdu. */ > if (!(phtpriv->ampdu_enable) && pregistrypriv->ampdu_enable == 1) { > - if (pregistrypriv->wifi_spec == 1) { > - /* remove this part because testbed AP should disable RX AMPDU */ > - /* phtpriv->ampdu_enable = false; */ > - phtpriv->ampdu_enable = true; > - } else { > - phtpriv->ampdu_enable = true; > - } > - } else if (pregistrypriv->ampdu_enable == 2) { > - /* remove this part because testbed AP should disable RX AMPDU */ > - /* phtpriv->ampdu_enable = true; */ > + phtpriv->ampdu_enable = true; This isn't the same test. This could be: if ((!(phtpriv->ampdu_enable) && pregistrypriv->ampdu_enable == 1)) || pregistrypriv->ampdu_enable == 2) phtpriv->ampdu_enable = true; Though it is probably more sensible to just set phtpriv->ampdu_enable without testing whether or not it's already set: if (pregistrypriv->ampdu_enable == 1 || pregistrypriv->ampdu_enable == 2) phtpriv->ampdu_enable = true;