Re: drivers: Probable misuses of ||

From: Mark Brown
Date: Mon May 07 2012 - 04:36:06 EST


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 with no
analysis 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).

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.

Attachment: signature.asc
Description: Digital signature