Commit 2fdaf3f4 authored by Jonathan Cameron's avatar Jonathan Cameron

iio:light:ltr501 bug in parameter sanity check.

Clearly the intent was to error if the value was not 0 or 1.
As implemented we have (A != 0 || A != 1) which is always true
as A is never both 0 and 1 at the same time.

As the autobuilder suggested, && makes more sense for this error
check.
Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Acked-by: default avatarKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 6920ccf6
...@@ -976,7 +976,7 @@ static int ltr501_write_event_config(struct iio_dev *indio_dev, ...@@ -976,7 +976,7 @@ static int ltr501_write_event_config(struct iio_dev *indio_dev,
int ret; int ret;
/* only 1 and 0 are valid inputs */ /* only 1 and 0 are valid inputs */
if (state != 1 || state != 0) if (state != 1 && state != 0)
return -EINVAL; return -EINVAL;
switch (chan->type) { switch (chan->type) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment