Skip to contentSkip to conversation

iio: st_accel: remove redundant unsigned less than zero check

PATCH Applied Colin King 2 participants 2 messages Feb 21, 2019 – Mar 3, 2019

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 iio: st_accel: remove redundant unsigned less than zero check

From: Colin Ian King <[email protected]>

The check that variable val is less than zero is redundant since val is an unsigned int and hence can never be less than zero. Remove it.

---
 drivers/iio/accel/st_accel_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/st_accel_core.c +1 -1
index a3c0916479fa..9930edf423bf 100644
@@ -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.20.1
maintainer Applied
#1 lore raw
Quoted 6 lines · On Thu, 21 Feb 2019 10:46:36 +0000 Colin King <[email protected]> wrote:

From: Colin Ian King <[email protected]>

The check that variable val is less than zero is redundant since val is an unsigned int and hence can never be less than zero. Remove it.

Applied.

Thanks,

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
index a3c0916479fa..9930edf423bf 100644
@@ -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