Re: [PATCH] iio:light:ltr501 bug in parameter sanity check.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/05/15 16:31, Kuppuswamy Sathyanarayanan wrote:
> Good find. Please proceed with merge.
> 
> Acked-by: Kuppuswamy Sathyanarayanan 
> sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
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@xxxxxxxxx>
>> Cc: Kuppuswamy Sathyanarayanan
>> <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
>> Cc: Daniel Baluta <daniel.baluta@xxxxxxxxx>
>> Signed-off-by: Jonathan Cameron <jic23@xxxxxxxxxx>
>> ---
>> 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
>>
>>
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux