[PATCH] staging: comedi: don't override read/write subdevice if not supported

Ian Abbott abbotti at mev.co.uk
Tue Jan 29 13:17:24 UTC 2013


On 2013-01-29 12:41, Dan Carpenter wrote:
> On Tue, Jan 29, 2013 at 12:00:27PM +0000, Ian Abbott wrote:
>> diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
>> index b798e42..6bfaeef 100644
>> --- a/drivers/staging/comedi/comedi_fops.c
>> +++ b/drivers/staging/comedi/comedi_fops.c
>> @@ -2358,8 +2358,10 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev,
>>   	if (!info)
>>   		return -ENOMEM;
>>   	info->device = dev;
>> -	info->read_subdevice = s;
>> -	info->write_subdevice = s;
>> +	if ((s->subdev_flags & SDF_CMD_READ) != 0)
>
> This patch is fine but why add != 0 to if statements?

Force of habit because some compilers issue a warning when a bitwise 
operator is used in a context expecting a logical result.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-



More information about the devel mailing list