On Tuesday, May 06, 2014 3:46 AM, Ian Abbott wrote:
> On 2014-05-05 17:59, H Hartley Sweeten wrote:
>> Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
>> scan_begin_arg when the scan_begin_src is TRIG_TIMER.
>>
>> For aesthetics reasons, rename the local variable 'tmp' to 'arg'.
>>
>> Signed-off-by: H Hartley Sweeten <hswee...@visionengravers.com>
>> Cc: Ian Abbott <abbo...@mev.co.uk>
>> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
>> ---
>>   drivers/staging/comedi/drivers/amplc_pci224.c | 29 
>> +++++++++++++--------------
>>   1 file changed, 14 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c 
>> b/drivers/staging/comedi/drivers/amplc_pci224.c
>> index c2b352c..ec65a34 100644
>> --- a/drivers/staging/comedi/drivers/amplc_pci224.c
>> +++ b/drivers/staging/comedi/drivers/amplc_pci224.c
>> @@ -719,7 +719,7 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct 
>> comedi_subdevice *s,
>>   {
>>      struct pci224_private *devpriv = dev->private;
>>      int err = 0;
>> -    unsigned int tmp;
>> +    unsigned int arg;
>>
>>      /* Step 1 : check if triggers are trivially valid */
>>
>> @@ -746,14 +746,14 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct 
>> comedi_subdevice *s,
>>       * There's only one external trigger signal (which makes these
>>       * tests easier).  Only one thing can use it.
>>       */
>> -    tmp = 0;
>> +    err = 0;
>>      if (cmd->start_src & TRIG_EXT)
>> -            tmp++;
>> +            err++;
>>      if (cmd->scan_begin_src & TRIG_EXT)
>> -            tmp++;
>> +            err++;
>>      if (cmd->stop_src & TRIG_EXT)
>> -            tmp++;
>> -    if (tmp > 1)
>> +            err++;
>> +    if (err > 1)
>>              err |= -EINVAL;
>>
>>      if (err)
>
> That's wrong and breaks when any of the _src are set to TRIG_EXT.  It 
> also disregards any errors from step 2a.  It would have worked if you 
> had just replaced 'tmp' with 'arg' in the original version.

Sorry about that. I blame lack of sleep....

Hartley



_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to