From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752881AbbESFkV (ORCPT ); Tue, 19 May 2015 01:40:21 -0400 Received: from mail1.windriver.com ([147.11.146.13]:38755 "EHLO mail1.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835AbbESFkS (ORCPT ); Tue, 19 May 2015 01:40:18 -0400 Date: Tue, 19 May 2015 01:39:14 -0400 From: Paul Gortmaker To: "Dhere, Chaitanya (C.)" CC: "gregkh@linuxfoundation.org" , "cristina.opriceana@gmail.com" , "gdonald@gmail.com" , "hamohammed.sa@gmail.com" , "mahfouz.saif.elyazal@gmail.com" , "benoit.taine@lip6.fr" , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] staging: rtl8192u: Modify if, else if conditions to remove unnecessary equality checks. This change was detected with the help of coccinelle tool. Message-ID: <20150519053914.GP497@windriver.com> References: <20150518155857.GA5960@chaitanya-Ideapad-Z560> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20150518155857.GA5960@chaitanya-Ideapad-Z560> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [[PATCH] staging: rtl8192u: Modify if, else if conditions to remove unnecessary equality checks. This change was detected with the help of coccinelle tool.] On 18/05/2015 (Mon 16:00) Dhere, Chaitanya (C.) wrote: > Signed-off-by: Chaitanya Dhere > Reply-To: > > --- > drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > index d2e8b12..30b0135 100644 > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > @@ -1364,12 +1364,11 @@ static void ieee80211_associate_complete_wq(struct work_struct *work) > ieee->LinkDetectInfo.NumRecvDataInPeriod= 1; > } > ieee->link_change(ieee->dev); > - if(ieee->is_silent_reset == 0){ > + if (!ieee->is_silent_reset) { > printk("============>normal associate\n"); > notify_wx_assoc_event(ieee); > } In addition to Greg's comments, I'd ask while here, what about the misleading lack of indent on the notify_wx_assoc_event() call above? That would concern me more than trivial equality check changes that gcc will no doubt optimize to the same thing. > - else if(ieee->is_silent_reset == 1) > - { > + else if (ieee->is_silent_reset) { But why leave the "else if" vs an "else"? You know this: staging/rtl8192u/ieee80211/ieee80211.h: bool is_silent_reset; and you've already tested "if (!ieee->is_silent_reset)". By definition, a bool can have only two values and you've already tested for one of them, so... Paul. -- > printk("==================>silent reset associate\n"); > ieee->is_silent_reset = false; > } > -- > 1.9.1