mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jarod Wilson <jarod@redhat.com>
Subject: Re: drivers: Probable misuses of ||
Date: Mon, 07 May 2012 09:20:34 -0700	[thread overview]
Message-ID: <1336407634.18931.5.camel@joe2Laptop> (raw)
In-Reply-To: <20120507083602.GA4415@opensource.wolfsonmicro.com>

On Mon, 2012-05-07 at 09:36 +0100, Mark Brown wrote:
> On Sat, May 05, 2012 at 09:00:42AM -0700, Guenter Roeck wrote:
> > On Fri, May 04, 2012 at 06:13:33PM -0400, Mark Brown wrote:
> 
> > > Right, but you need to look at the code and explain why this is a
> > > problem.  For example, the case I've left quoted above reads to me like
> > > the intention is "If the chip isn't one I know doesn't like this then
> > > let's do it" which is a perfectly sensible thing to write.
> 
> > I can not really follow your logic here; it is difficult for me to imagine a situation
> > where anything along the line of
> > 	if (val != 1 || val != 2)
> > would provide value other than creating confusion. Maybe you can explain that a bit further.
> 
> Yeah, I hadn't actually read the code closely enough but it's not my
> main point anyway - the main point was that the reports were very easy
> to ignore because they're just a paste in of the error message

Nope, these were the original source codes.

> with no analysis 

You did elide the "Likely the || should be &&" preface.

> they were very likely to just get ignored unless someone has a
> particular interest in the code (which is essentially what I did - I
> glanced at the report but only very briefly).

No worries, I miss things when I scan code too quickly
as well.

> Compare this with the reports from people like Julia Lawall, for example
> - they tend to be very clear.  Even simply adding "...as with || they
> will always be true" would've helped.

I think it's a pretty basic logic error that most all
lkml readers should be able to identify most of the time.

cheers, Joe


  reply	other threads:[~2012-05-07 16:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-04 23:00 Joe Perches
2012-05-04 21:54 ` Joe Perches
2012-05-04 22:02   ` Mark Brown
2012-05-04 22:09     ` Joe Perches
2012-05-04 22:13       ` Mark Brown
2012-05-05 16:00         ` Guenter Roeck
2012-05-07  8:36           ` Mark Brown
2012-05-07 16:20             ` Joe Perches [this message]
2012-05-07 16:34               ` Mark Brown
2012-05-04 22:56   ` Alan Cox
2012-05-04 23:13     ` Joe Perches
2012-05-04 22:45 ` richard -rw- weinberger
2012-05-07 10:45 ` Mauro Carvalho Chehab
2012-05-07 15:22   ` [PATCH] re: drivers: Probable misuses of || - it913x.c Malcolm Priestley
2012-05-07 11:04 ` drivers: Probable misuses of || Mauro Carvalho Chehab

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=1336407634.18931.5.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=JBottomley@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=guenter.roeck@ericsson.com \
    --cc=jarod@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®