Re: [PATCH] iio: light: si1133: fix an && vs || typo

Jonathan Cameron
2018-08-01T17:59:07Z

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,