All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [patch 3/9] ath9k: cleanup: u32 => bool
Date: Mon, 10 May 2010 16:46:26 +0200	[thread overview]
Message-ID: <20100510144625.GW27064@bicker> (raw)
In-Reply-To: <1273477106.3573.0.camel@jlt3.sipsolutions.net>

On Mon, May 10, 2010 at 09:38:26AM +0200, Johannes Berg wrote:
> On Sat, 2010-05-08 at 18:22 +0200, Dan Carpenter wrote:
> 
> > +		bool on = param ? 1 : 0;
> 
> umm, if you're going to use bool then use true/false too.
> 
> johannes

The 1 and 0 are used as array indexes so it looks funny to use true and
false.

Let's just drop this patch.  I wrote it to silence a smatch false 
positive but I should/will just fix smatch instead.

Smatch complains we negate a non-boolean type here:

                if (!on != aniState->ofdmWeakSigDetectOff) {

It's a quite common bug to forget that negation has higher precendence 
than compare operations.  In this case, it's clear from code that "on" is
either 1 or 0 so smatch should not complain.

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "Luis R. Rodriguez" <lrodriguez@atheros.com>,
	Jouni Malinen <jmalinen@atheros.com>,
	Sujith Manoharan <Sujith.Manoharan@atheros.com>,
	Vasanthakumar Thiagarajan <vasanth@atheros.com>,
	Senthil Balasubramanian <senthilkumar@atheros.com>,
	"John W. Linville" <linville@tuxdriver.com>,
	Felix Fietkau <nbd@openwrt.org>,
	linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org
Subject: Re: [patch 3/9] ath9k: cleanup: u32 => bool
Date: Mon, 10 May 2010 16:46:26 +0200	[thread overview]
Message-ID: <20100510144625.GW27064@bicker> (raw)
In-Reply-To: <1273477106.3573.0.camel@jlt3.sipsolutions.net>

On Mon, May 10, 2010 at 09:38:26AM +0200, Johannes Berg wrote:
> On Sat, 2010-05-08 at 18:22 +0200, Dan Carpenter wrote:
> 
> > +		bool on = param ? 1 : 0;
> 
> umm, if you're going to use bool then use true/false too.
> 
> johannes

The 1 and 0 are used as array indexes so it looks funny to use true and
false.

Let's just drop this patch.  I wrote it to silence a smatch false 
positive but I should/will just fix smatch instead.

Smatch complains we negate a non-boolean type here:

                if (!on != aniState->ofdmWeakSigDetectOff) {

It's a quite common bug to forget that negation has higher precendence 
than compare operations.  In this case, it's clear from code that "on" is
either 1 or 0 so smatch should not complain.

regards,
dan carpenter

  reply	other threads:[~2010-05-10 14:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-08 16:22 [ath9k-devel] [patch 3/9] ath9k: cleanup: u32 => bool Dan Carpenter
2010-05-08 16:22 ` Dan Carpenter
2010-05-10  7:38 ` [ath9k-devel] " Johannes Berg
2010-05-10  7:38   ` Johannes Berg
2010-05-10 14:46   ` Dan Carpenter [this message]
2010-05-10 14:46     ` Dan Carpenter
2010-05-10 15:00     ` [ath9k-devel] " Pavel Roskin
2010-05-10 15:00       ` Pavel Roskin

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=20100510144625.GW27064@bicker \
    --to=error27@gmail.com \
    --cc=ath9k-devel@lists.ath9k.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.