diff mbox series

[next] iio: st_accel: remove redundant unsigned less than zero check

Message ID 20190221104636.1922-1-colin.king@canonical.com (mailing list archive)
State New, archived
Headers show
Series [next] iio: st_accel: remove redundant unsigned less than zero check | expand

Commit Message

Colin King Feb. 21, 2019, 10:46 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

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.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/iio/accel/st_accel_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron March 3, 2019, 4:16 p.m. UTC | #1
On Thu, 21 Feb 2019 10:46:36 +0000
Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> 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.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Applied.

Thanks,

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
diff mbox series

Patch

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