staging: comedi: cb_pcidas: clarify the ai cmd->start_arg validation
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 17 Apr 2014 17:07:56 +0000 (10:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Apr 2014 17:21:31 +0000 (10:21 -0700)
This driver supports two cmd->start_src values, TRIG_NOW and TRIG_EXT.

For aesthetics, replace the default case when validating the cmd->start_arg
with the proper case statement.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/cb_pcidas.c

index 70d926707777178f4cccfb5e1b803b3a7e31d14f..523378fbf302de1713d9420101ab9c6d2c5d04b3 100644 (file)
@@ -872,9 +872,12 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev,
        if (err)
                return 2;
 
-       /* step 3: arguments are trivially compatible */
+       /* Step 3: check if arguments are trivially valid */
 
        switch (cmd->start_src) {
+       case TRIG_NOW:
+               err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0);
+               break;
        case TRIG_EXT:
                /* External trigger, only CR_EDGE and CR_INVERT flags allowed */
                if ((cmd->start_arg
@@ -888,9 +891,6 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev,
                        err |= -EINVAL;
                }
                break;
-       default:
-               err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0);
-               break;
        }
 
        if (cmd->scan_begin_src == TRIG_TIMER)