From: Jonathan Cameron <jic23@kernel.org>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Daniel Drake <drake@endlessm.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: st_accel: remove unnecessary comparison of unsigned integer with < 0
Date: Sun, 24 Mar 2019 12:25:44 +0000 [thread overview]
Message-ID: <20190324122544.4fe69a14@archlinux> (raw)
In-Reply-To: <20190318173302.GA10761@embeddedor>
On Mon, 18 Mar 2019 12:33:02 -0500
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> There is no need to compare *val* with < 0 because such comparison
> of an unsigned value is always false.
>
> Fix this by removing such comparison.
>
> Addresses-Coverity-ID: 1443919 ("Unsigned compared against 0")
> Fixes: f38ab20b749d ("iio: st_accel: use ACPI orientation data")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Thanks,
Colin King got there first and I have a patch fixing this queued up.
Jonathan
> ---
> drivers/iio/accel/st_accel_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> index a3c0916479fa..9930edf423bf 100644
> --- a/drivers/iio/accel/st_accel_core.c
> +++ b/drivers/iio/accel/st_accel_core.c
> @@ -992,7 +992,7 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev,
> goto out;
>
> val = elements[i].integer.value;
> - if (val < 0 || val > 2)
> + if (val > 2)
> goto out;
>
> /* Avoiding full matrix multiplication, we simply reorder the
prev parent reply other threads:[~2019-03-24 12:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-18 17:33 [PATCH] iio: st_accel: remove unnecessary comparison of unsigned integer with < 0 Gustavo A. R. Silva
2019-03-24 12:25 ` Jonathan Cameron [this message]
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=20190324122544.4fe69a14@archlinux \
--to=jic23@kernel.org \
--cc=drake@endlessm.com \
--cc=gustavo@embeddedor.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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