All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: light: si1133: fix an && vs || typo
@ 2018-07-31 18:11 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-07-31 18:11 UTC (permalink / raw)
  To: Jonathan Cameron, Maxime Roussin-Bélanger
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Jean-Francois Dagenais, linux-iio, kernel-janitors

The "val" variable can't be both 0 and 1 at the same time so this will
always return -EINVAL.

Fixes: e01e7eaf37d8 ("iio: light: introduce si1133")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c
index d3fbeb3bc463..5ac22c46da1f 100644
--- a/drivers/iio/light/si1133.c
+++ b/drivers/iio/light/si1133.c
@@ -838,7 +838,7 @@ static int si1133_write_raw(struct iio_dev *iio_dev,
 		switch (chan->type) {
 		case IIO_INTENSITY:
 		case IIO_UVINDEX:
-			if (val != 0 || val != 1)
+			if (val != 0 && val != 1)
 				return -EINVAL;
 
 			return si1133_update_adcsens(data,

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

end of thread, other threads:[~2018-08-01 19:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-31 18:11 [PATCH] iio: light: si1133: fix an && vs || typo Dan Carpenter
2018-07-31 18:11 ` Dan Carpenter
2018-08-01 17:59 ` Jonathan Cameron
2018-08-01 17:59   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.