From: David Laight <David.Laight@ACULAB.COM>
To: 'Dan Carpenter' <dan.carpenter@oracle.com>
Cc: 'Mauro Carvalho Chehab' <mchehab@kernel.org>,
Ashish Kalra <eashishkalra@gmail.com>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Subject: RE: [PATCH] media: atomisp: silence "dubious: !x | !y" warning
Date: Tue, 20 Apr 2021 10:36:32 +0000 [thread overview]
Message-ID: <ee70a3553f3143fe9d64ec20688782d2@AcuMS.aculab.com> (raw)
In-Reply-To: <20210420102747.GB1981@kadam>
From: Dan Carpenter
> Sent: 20 April 2021 11:28
>
> On Sat, Apr 17, 2021 at 09:31:32PM +0000, David Laight wrote:
> > From: Mauro Carvalho Chehab
> > > Sent: 17 April 2021 19:56
> > >
> > > Em Sat, 17 Apr 2021 21:06:27 +0530
> > > Ashish Kalra <eashishkalra@gmail.com> escreveu:
> > >
> > > > Upon running sparse, "warning: dubious: !x | !y" is brought to notice
> > > > for this file. Logical and bitwise OR are basically the same in this
> > > > context so it doesn't cause a runtime bug. But let's change it to
> > > > logical OR to make it cleaner and silence the Sparse warning.
> >
> > The old code is very likely to by slightly more efficient.
> >
> > It may not matter here, but it might in a really hot path.
> >
> > Since !x | !y and !x || !y always have the same value
> > why is sparse complaining at all.
> >
>
> Smatch doesn't warn about | vs || if both sides are true/false. But
> I've occasionally asked people if they were trying to do a fast path
> optimization but it's always just a typo.
The problem is with people blindly patching code to 'fix'
these warnings.
It might just be a fast path optimisation - which they break.
Trying to beat the compiler into submission can be hard though.
Getting it to 'or' together the outputs from a series of x86
'setne' instructions isn't for the faint hearted.
Not helped by the instruction only setting %al.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2021-04-20 10:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-17 15:36 [PATCH] media: atomisp: silence "dubious: !x | !y" warning Ashish Kalra
2021-04-17 18:56 ` Mauro Carvalho Chehab
2021-04-17 21:31 ` David Laight
2021-04-18 1:15 ` Ashish Kalra
2021-04-18 21:59 ` Luc Van Oostenryck
2021-04-20 10:27 ` Dan Carpenter
2021-04-20 10:36 ` David Laight [this message]
2021-04-18 1:26 ` Ashish Kalra
2021-04-20 12:04 ` Hans Verkuil
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=ee70a3553f3143fe9d64ec20688782d2@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=eashishkalra@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.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).