From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Jonathan Cameron <jic23@kernel.org>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@linux.intel.com>,
Daniel Baluta <daniel.baluta@intel.com>
Subject: [PATCH] iio:light:ltr501 bug in parameter sanity check.
Date: Sat, 2 May 2015 11:25:48 +0100 [thread overview]
Message-ID: <1430562348-27802-1-git-send-email-jic23@kernel.org> (raw)
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
next reply other threads:[~2015-05-02 10:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-02 10:25 Jonathan Cameron [this message]
2015-05-02 15:31 ` [PATCH] iio:light:ltr501 bug in parameter sanity check Kuppuswamy Sathyanarayanan
2015-05-03 19:03 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430562348-27802-1-git-send-email-jic23@kernel.org \
--to=jic23@kernel.org \
--cc=daniel.baluta@intel.com \
--cc=linux-iio@vger.kernel.org \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox