diff mbox series

iio: light: si1133: fix an && vs || typo

Message ID 20180731181134.rp57ywlshwqm4onu@kili.mountain (mailing list archive)
State New, archived
Headers show
Series iio: light: si1133: fix an && vs || typo | expand

Commit Message

Dan Carpenter July 31, 2018, 6:11 p.m. UTC
The "val" variable can't be both 0 and 1 at the same time so this will
always return -EINVAL.

Fixes: e01e7eaf37d8 ("iio: light: introduce si1133")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jonathan Cameron Aug. 1, 2018, 5:59 p.m. UTC | #1
On Tue, 31 Jul 2018 21:11:34 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The "val" variable can't be both 0 and 1 at the same time so this will
> always return -EINVAL.
> 
> Fixes: e01e7eaf37d8 ("iio: light: introduce si1133")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks.  This time Colin King beat you to it.

Jonathan

> 
> diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c
> index d3fbeb3bc463..5ac22c46da1f 100644
> --- a/drivers/iio/light/si1133.c
> +++ b/drivers/iio/light/si1133.c
> @@ -838,7 +838,7 @@ static int si1133_write_raw(struct iio_dev *iio_dev,
>  		switch (chan->type) {
>  		case IIO_INTENSITY:
>  		case IIO_UVINDEX:
> -			if (val != 0 || val != 1)
> +			if (val != 0 && val != 1)
>  				return -EINVAL;
>  
>  			return si1133_update_adcsens(data,

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c
index d3fbeb3bc463..5ac22c46da1f 100644
--- a/drivers/iio/light/si1133.c
+++ b/drivers/iio/light/si1133.c
@@ -838,7 +838,7 @@  static int si1133_write_raw(struct iio_dev *iio_dev,
 		switch (chan->type) {
 		case IIO_INTENSITY:
 		case IIO_UVINDEX:
-			if (val != 0 || val != 1)
+			if (val != 0 && val != 1)
 				return -EINVAL;
 
 			return si1133_update_adcsens(data,