All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anders Roxell <anders.roxell@linaro.org>
To: Greg KH <greg@kroah.com>
Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org,
	woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
	davem@davemloft.net, netdev@vger.kernel.org,
	linux-usb@vger.kernel.org, clang-built-linux@googlegroups.com,
	ulli.kroll@googlemail.com, linux@armlinux.org.uk,
	linux-arm-kernel@lists.infradead.org, amitkarwar@gmail.com,
	nishants@marvell.com, gbhat@marvell.com, huxinming820@gmail.com,
	kvalo@codeaurora.org, linux-wireless@vger.kernel.org,
	rostedt@goodmis.org, mingo@redhat.com, dmitry.torokhov@gmail.com,
	ndesaulniers@google.com, nathan@kernel.org,
	linux-input@vger.kernel.org
Subject: Re: [PATCH 4.19 6/6] Input: touchscreen - avoid bitwise vs logical OR warning
Date: Tue, 21 Dec 2021 13:24:38 +0100	[thread overview]
Message-ID: <CADYN=9K8fD7sSdTy+mCY6dvjutabLnibs3BoAmv1W4sKcPLpXw@mail.gmail.com> (raw)
In-Reply-To: <YcBiFomrxSw1eEUB@kroah.com>

On Mon, 20 Dec 2021 at 11:59, Greg KH <greg@kroah.com> wrote:
>
> On Fri, Dec 17, 2021 at 03:41:19PM +0100, Anders Roxell wrote:
> > From: Nathan Chancellor <nathan@kernel.org>
> >
> > commit a02dcde595f7cbd240ccd64de96034ad91cffc40 upstream.
> >
> > A new warning in clang points out a few places in this driver where a
> > bitwise OR is being used with boolean types:
> >
> > drivers/input/touchscreen.c:81:17: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
> >         data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-x",
> >                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > This use of a bitwise OR is intentional, as bitwise operations do not
> > short circuit, which allows all the calls to touchscreen_get_prop_u32()
> > to happen so that the last parameter is initialized while coalescing the
> > results of the calls to make a decision after they are all evaluated.
> >
> > To make this clearer to the compiler, use the '|=' operator to assign
> > the result of each touchscreen_get_prop_u32() call to data_present,
> > which keeps the meaning of the code the same but makes it obvious that
> > every one of these calls is expected to happen.
> >
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> > Link: https://lore.kernel.org/r/20211014205757.3474635-1-nathan@kernel.org
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> > ---
> >  drivers/input/touchscreen/of_touchscreen.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
>
> Also needed in 5.10.y and 5.4.y.
>
> Please be more careful next time.

Yes I will, I'm sorry.

Cheers,
Anders

WARNING: multiple messages have this Message-ID (diff)
From: Anders Roxell <anders.roxell@linaro.org>
To: Greg KH <greg@kroah.com>
Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org,
	 woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
	davem@davemloft.net,  netdev@vger.kernel.org,
	linux-usb@vger.kernel.org,  clang-built-linux@googlegroups.com,
	ulli.kroll@googlemail.com,  linux@armlinux.org.uk,
	linux-arm-kernel@lists.infradead.org,  amitkarwar@gmail.com,
	nishants@marvell.com, gbhat@marvell.com,  huxinming820@gmail.com,
	kvalo@codeaurora.org, linux-wireless@vger.kernel.org,
	 rostedt@goodmis.org, mingo@redhat.com,
	dmitry.torokhov@gmail.com,  ndesaulniers@google.com,
	nathan@kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH 4.19 6/6] Input: touchscreen - avoid bitwise vs logical OR warning
Date: Tue, 21 Dec 2021 13:24:38 +0100	[thread overview]
Message-ID: <CADYN=9K8fD7sSdTy+mCY6dvjutabLnibs3BoAmv1W4sKcPLpXw@mail.gmail.com> (raw)
In-Reply-To: <YcBiFomrxSw1eEUB@kroah.com>

On Mon, 20 Dec 2021 at 11:59, Greg KH <greg@kroah.com> wrote:
>
> On Fri, Dec 17, 2021 at 03:41:19PM +0100, Anders Roxell wrote:
> > From: Nathan Chancellor <nathan@kernel.org>
> >
> > commit a02dcde595f7cbd240ccd64de96034ad91cffc40 upstream.
> >
> > A new warning in clang points out a few places in this driver where a
> > bitwise OR is being used with boolean types:
> >
> > drivers/input/touchscreen.c:81:17: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
> >         data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-x",
> >                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > This use of a bitwise OR is intentional, as bitwise operations do not
> > short circuit, which allows all the calls to touchscreen_get_prop_u32()
> > to happen so that the last parameter is initialized while coalescing the
> > results of the calls to make a decision after they are all evaluated.
> >
> > To make this clearer to the compiler, use the '|=' operator to assign
> > the result of each touchscreen_get_prop_u32() call to data_present,
> > which keeps the meaning of the code the same but makes it obvious that
> > every one of these calls is expected to happen.
> >
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> > Link: https://lore.kernel.org/r/20211014205757.3474635-1-nathan@kernel.org
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> > ---
> >  drivers/input/touchscreen/of_touchscreen.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
>
> Also needed in 5.10.y and 5.4.y.
>
> Please be more careful next time.

Yes I will, I'm sorry.

Cheers,
Anders

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-12-21 12:24 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 14:41 [PATCH 4.19 0/6] fix warning and errors on arm built with clang Anders Roxell
2021-12-17 14:41 ` Anders Roxell
2021-12-17 14:41 ` [PATCH 4.19 1/6] net: lan78xx: Avoid unnecessary self assignment Anders Roxell
2021-12-17 14:41   ` Anders Roxell
2021-12-17 14:41 ` [PATCH 4.19 2/6] ARM: 8805/2: remove unneeded naked function usage Anders Roxell
2021-12-17 14:41   ` Anders Roxell
2021-12-17 14:41 ` [PATCH 4.19 3/6] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO Anders Roxell
2021-12-17 14:41   ` Anders Roxell
2021-12-20 10:56   ` Greg KH
2021-12-20 10:56     ` Greg KH
2021-12-20 12:13   ` Joe Perches
2021-12-20 12:13     ` Joe Perches
2021-12-20 14:00     ` David Laight
2021-12-20 14:00       ` David Laight
2021-12-17 14:41 ` [PATCH 4.19 4/6] ARM: 8800/1: use choice for kernel unwinders Anders Roxell
2021-12-17 14:41   ` Anders Roxell
2021-12-17 14:41 ` [PATCH 4.19 5/6] ARM: 8788/1: ftrace: remove old mcount support Anders Roxell
2021-12-17 14:41   ` Anders Roxell
2021-12-20 10:57   ` Greg KH
2021-12-20 10:57     ` Greg KH
2022-01-11 20:58     ` Stefan Agner
2022-01-11 20:58       ` Stefan Agner
2022-01-11 21:04   ` Nick Desaulniers
2022-01-11 21:04     ` Nick Desaulniers
2021-12-17 14:41 ` [PATCH 4.19 6/6] Input: touchscreen - avoid bitwise vs logical OR warning Anders Roxell
2021-12-17 14:41   ` Anders Roxell
2021-12-20 10:59   ` Greg KH
2021-12-20 10:59     ` Greg KH
2021-12-21 12:24     ` Anders Roxell [this message]
2021-12-21 12:24       ` Anders Roxell

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='CADYN=9K8fD7sSdTy+mCY6dvjutabLnibs3BoAmv1W4sKcPLpXw@mail.gmail.com' \
    --to=anders.roxell@linaro.org \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=amitkarwar@gmail.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=davem@davemloft.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gbhat@marvell.com \
    --cc=greg@kroah.com \
    --cc=huxinming820@gmail.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=nishants@marvell.com \
    --cc=rostedt@goodmis.org \
    --cc=stable@vger.kernel.org \
    --cc=ulli.kroll@googlemail.com \
    --cc=woojung.huh@microchip.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.