public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio:light:ltr501 bug in parameter sanity check.
@ 2015-05-02 10:25 Jonathan Cameron
  2015-05-02 15:31 ` Kuppuswamy Sathyanarayanan
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2015-05-02 10:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Kuppuswamy Sathyanarayanan, Daniel Baluta

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>
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
This is obvious enough that I'll probably apply it shortly whether or
not I get Acks.  However, Acks always good!

drivers/iio/light/ltr501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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,
 	int ret;
 
 	/* only 1 and 0 are valid inputs */
-	if (state != 1  || state != 0)
+	if (state != 1  && state != 0)
 		return -EINVAL;
 
 	switch (chan->type) {
-- 
2.3.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-03 19:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-02 10:25 [PATCH] iio:light:ltr501 bug in parameter sanity check Jonathan Cameron
2015-05-02 15:31 ` Kuppuswamy Sathyanarayanan
2015-05-03 19:03   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox