From: Joe Perches <joe@perches.com>
To: Shiva Kerdel <shiva@exdev.nl>, gregkh@linuxfoundation.org
Cc: wsa+renesas@sang-engineering.com, p.hoefflin@posteo.de,
karniksayli1995@gmail.com, sabitha.george@gmail.com,
georgiana.chelu93@gmail.com, goudapatilk@gmail.com,
mihaela.muraru21@gmail.com, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: ks7010: ks_*: Braces should be used on all arms of these statements
Date: Fri, 17 Feb 2017 18:37:20 -0800 [thread overview]
Message-ID: <1487385440.2198.18.camel@perches.com> (raw)
In-Reply-To: <1487371848.2198.6.camel@perches.com>
On Fri, 2017-02-17 at 14:50 -0800, Joe Perches wrote:
> On Fri, 2017-02-17 at 22:41 +0100, Shiva Kerdel wrote:
> > Braces should be used on all arms of these statements (CHECK)..
>
> []
> > diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
>
> []
> > @@ -2148,8 +2148,9 @@ void hostif_sme_mode_setup(struct ks_wlan_private *priv)
> > else
> > rate_octet[i] =
> > priv->reg.rate_set.body[i];
> > - } else
> > + } else {
> > break;
> > + }
>
> Generally, any time you see a form like this,
> the test should be reversed
>
> for/while/do {
> if (foo) {
> [bar...]
> } else {
> break;
> }
>
> should be:
>
> for/while/do {
> if (!foo)
> break;
> [bar...]
> }
btw: the code would read better using
a temporary. Something like:
if (priv->reg.phy_type == D_11B_ONLY_MODE) {
for (i = 0; i < priv->reg.rate_set.size; i++) {
u8 rate = priv->reg.rate_set.body[i];
if (!IS_11B_RATE(rate))
break;
rate_octet[i] = ((rate & RATE_MASK) >= TX_RATE_5M)
? (rate & RATE_MASK) : rate;
}
prev parent reply other threads:[~2017-02-18 2:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 21:41 [PATCH] Staging: ks7010: ks_*: Braces should be used on all arms of these statements Shiva Kerdel
2017-02-17 22:50 ` Joe Perches
2017-02-18 2:37 ` Joe Perches [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=1487385440.2198.18.camel@perches.com \
--to=joe@perches.com \
--cc=devel@driverdev.osuosl.org \
--cc=georgiana.chelu93@gmail.com \
--cc=goudapatilk@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=karniksayli1995@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mihaela.muraru21@gmail.com \
--cc=p.hoefflin@posteo.de \
--cc=sabitha.george@gmail.com \
--cc=shiva@exdev.nl \
--cc=wsa+renesas@sang-engineering.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