]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iio:light:ltr501 bug in parameter sanity check.
authorJonathan Cameron <jic23@kernel.org>
Sat, 2 May 2015 10:25:48 +0000 (11:25 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sun, 3 May 2015 18:59:25 +0000 (19:59 +0100)
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>
drivers/iio/light/ltr501.c

index ca4bf470a3325a70bf251e43ef52917b5f869e06..280eff19b87243797ba1181a705a116a589f8b0d 100644 (file)
@@ -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) {