[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOd=wGjd_L1703Y9Kngcr9-_wTvcRLToiydXYkR=S_9xWDw@mail.gmail.com>
Date: Mon, 18 Oct 2021 13:14:05 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Nathan Chancellor <nathan@...nel.org>,
Henrique de Moraes Holschuh <hmh@....eng.br>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>,
ibm-acpi-devel@...ts.sourceforge.net,
platform-driver-x86@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
llvm@...ts.linux.dev, Tor Vic <torvic9@...lbox.org>
Subject: Re: [PATCH] platform/x86: thinkpad_acpi: Fix bitwise vs. logical warning
On Mon, Oct 18, 2021 at 12:41 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> On Mon, Oct 18, 2021 at 8:34 AM Nick Desaulniers
> <ndesaulniers@...gle.com> wrote:
> >
> > LGTM, thanks for the patch! I guess this would be the first
> > "interesting" case this warning has found in kernel sources?
>
> The patch looks obviously correct (tm), but I'm not convinced that the
> warning is actually all that interesting.
>
> The thing is, using bitwise operators for booleans is _exactly_ the
> same as using logical ones as long as there are no side effects.
Right, the patch that added the warning explicitly checks for side effects.
https://reviews.llvm.org/D108003
https://lore.kernel.org/lkml/20211018193101.2340261-1-nathan@kernel.org/
is another example that I would point to in favor of the error.
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists