iio: st_accel: remove unnecessary comparison of unsigned integer with < 0
PATCH 1/1 iio: st_accel: remove unnecessary comparison of unsigned integer with < 0
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 <[email protected]>
--- drivers/iio/accel/st_accel_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/st_accel_core.c +1 -1
@@ -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
Signature · 1 line
2.21.0
Jonathan Cameron
maintainerQuoted 8 lines · On Mon, 18 Mar 2019 12:33:02 -0500 "Gustavo A. R. Silva"…
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 <[email protected]>
Thanks,
Colin King got there first and I have a patch fixing this queued up.
Jonathan
Quoted 17 lines
--- drivers/iio/accel/st_accel_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/accel/st_accel_core.c +1
-1@@ -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