All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: sathyanarayanan.kuppuswamy@linux.intel.com
Cc: linux-iio@vger.kernel.org, Daniel Baluta <daniel.baluta@intel.com>
Subject: Re: [PATCH] iio:light:ltr501 bug in parameter sanity check.
Date: Sun, 03 May 2015 20:03:31 +0100	[thread overview]
Message-ID: <55467103.1050000@kernel.org> (raw)
In-Reply-To: <56744.10.252.205.185.1430580699.squirrel@linux.intel.com>

On 02/05/15 16:31, Kuppuswamy Sathyanarayanan wrote:
> Good find. Please proceed with merge.
> 
> Acked-by: Kuppuswamy Sathyanarayanan 
> sathyanarayanan.kuppuswamy@linux.intel.com>
Thanks and applied.
> 
>> 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
>>
>>
> 
> 


      reply	other threads:[~2015-05-03 19:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=55467103.1050000@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 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.