From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: "Dhere, Chaitanya (C.)" <cvijaydh@visteon.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"cristina.opriceana@gmail.com" <cristina.opriceana@gmail.com>,
"gdonald@gmail.com" <gdonald@gmail.com>,
"hamohammed.sa@gmail.com" <hamohammed.sa@gmail.com>,
"mahfouz.saif.elyazal@gmail.com" <mahfouz.saif.elyazal@gmail.com>,
"benoit.taine@lip6.fr" <benoit.taine@lip6.fr>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"linux-kernel@vger.kernel.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.
Date: Tue, 19 May 2015 01:39:14 -0400 [thread overview]
Message-ID: <20150519053914.GP497@windriver.com> (raw)
In-Reply-To: <20150518155857.GA5960@chaitanya-Ideapad-Z560>
[[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 <cvijaydh@visteon.com>
> 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
prev parent reply other threads:[~2015-05-19 5:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 16:00 [PATCH] staging: rtl8192u: Modify if, else if conditions to remove unnecessary equality checks. This change was detected with the help of coccinelle tool Dhere, Chaitanya (C.)
2015-05-18 22:41 ` gregkh
2015-05-19 5:39 ` Paul Gortmaker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150519053914.GP497@windriver.com \
--to=paul.gortmaker@windriver.com \
--cc=benoit.taine@lip6.fr \
--cc=cristina.opriceana@gmail.com \
--cc=cvijaydh@visteon.com \
--cc=devel@driverdev.osuosl.org \
--cc=gdonald@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hamohammed.sa@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mahfouz.saif.elyazal@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).