Skip to content

Commit

Permalink
iio:light:ltr501 bug in parameter sanity check.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Kuppuswamy Sathyanarayanan <[email protected]>
Cc: Daniel Baluta <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
jic23 committed May 3, 2015
1 parent 6920ccf commit 2fdaf3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/light/ltr501.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ static int ltr501_write_event_config(struct iio_dev *indio_dev,
int ret;

/* only 1 and 0 are valid inputs */
if (state != 1 || state != 0)
if (state != 1 && state != 0)
return -EINVAL;

switch (chan->type) {
Expand Down

0 comments on commit 2fdaf3f

Please sign in to comment.