diff options
author | Jonathan Cameron <jic23@kernel.org> | 2015-05-02 06:25:48 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-05-03 14:59:25 -0400 |
commit | 2fdaf3f4f8c718a5023db69e2d391d978e94703e (patch) | |
tree | 1ea00d4054bf36830ba62f6a7a1ddc204b908bf2 | |
parent | 6920ccf65d0964f7f6c6c36c551151e0fcd62327 (diff) |
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: kbuild test robot <fengguang.wu@intel.com>
Acked-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | drivers/iio/light/ltr501.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index ca4bf470a332..280eff19b872 100644 --- a/drivers/iio/light/ltr501.c +++ b/drivers/iio/light/ltr501.c | |||
@@ -976,7 +976,7 @@ static int ltr501_write_event_config(struct iio_dev *indio_dev, | |||
976 | int ret; | 976 | int ret; |
977 | 977 | ||
978 | /* only 1 and 0 are valid inputs */ | 978 | /* only 1 and 0 are valid inputs */ |
979 | if (state != 1 || state != 0) | 979 | if (state != 1 && state != 0) |
980 | return -EINVAL; | 980 | return -EINVAL; |
981 | 981 | ||
982 | switch (chan->type) { | 982 | switch (chan->type) { |