Logic error
authorDavid Schleef <ds@schleef.org>
Thu, 19 Apr 2001 07:27:33 +0000 (07:27 +0000)
committerDavid Schleef <ds@schleef.org>
Thu, 19 Apr 2001 07:27:33 +0000 (07:27 +0000)
comedi/drivers/check_driver
comedi/drivers/ni_mio_common.c

index 815b2e4d62641c0cf9bf1bc638227db2b7ab9294..04642156213b26e3fe7f1780732bdcde6e13044b 100755 (executable)
@@ -203,3 +203,7 @@ if grep 'request_region.*dev.*iobase' ${driver} &>/dev/null;then
        echo "W: recommend assigning dev->iobase after successful request_region()"
 fi
 
+if grep 'if.*cmd.*&&.*err..;' ${driver} &>/dev/null;then
+       echo "E: Probable logic error in cmdtest"
+fi
+
index 9335ab5bd3fb375810ed072d0f434c8d74a89929..603000f77496f95368867aa7f3006f6a7f7b3a90 100644 (file)
@@ -994,23 +994,23 @@ static int ni_ai_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd)
 
        tmp=cmd->start_src;
        cmd->start_src &= TRIG_NOW;
-       if(!cmd->start_src && tmp!=cmd->start_src)err++;
+       if(!cmd->start_src || tmp!=cmd->start_src)err++;
 
        tmp=cmd->scan_begin_src;
        cmd->scan_begin_src &= TRIG_TIMER|TRIG_EXT;
-       if(!cmd->scan_begin_src && tmp!=cmd->scan_begin_src)err++;
+       if(!cmd->scan_begin_src || tmp!=cmd->scan_begin_src)err++;
 
        tmp=cmd->convert_src;
        cmd->convert_src &= TRIG_TIMER|TRIG_EXT;
-       if(!cmd->convert_src && tmp!=cmd->convert_src)err++;
+       if(!cmd->convert_src || tmp!=cmd->convert_src)err++;
 
        tmp=cmd->scan_end_src;
        cmd->scan_end_src &= TRIG_COUNT;
-       if(!cmd->scan_end_src && tmp!=cmd->scan_end_src)err++;
+       if(!cmd->scan_end_src || tmp!=cmd->scan_end_src)err++;
 
        tmp=cmd->stop_src;
        cmd->stop_src &= TRIG_COUNT|TRIG_NONE;
-       if(!cmd->stop_src && tmp!=cmd->stop_src)err++;
+       if(!cmd->stop_src || tmp!=cmd->stop_src)err++;
 
        if(err)return 1;