Messages in this thread | | | From | Nick Desaulniers <> | Date | Mon, 18 Oct 2021 13:14:05 -0700 | Subject | Re: [PATCH] platform/x86: thinkpad_acpi: Fix bitwise vs. logical warning |
| |
On Mon, Oct 18, 2021 at 12:41 PM Linus Torvalds <torvalds@linux-foundation.org> wrote: > > On Mon, Oct 18, 2021 at 8:34 AM Nick Desaulniers > <ndesaulniers@google.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
| |