THe comedi core ensures that the chanlist will be valid for any async operation
other than Step 1 of the (*do_cmdtest) to get the trigger source masks.

Remove the unnecessary checks.

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_pci230.c | 33 +++++++++++----------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c 
b/drivers/staging/comedi/drivers/amplc_pci230.c
index 3895bc7..c87260c 100644
--- a/drivers/staging/comedi/drivers/amplc_pci230.c
+++ b/drivers/staging/comedi/drivers/amplc_pci230.c
@@ -1511,16 +1511,12 @@ static int pci230_ao_cancel(struct comedi_device *dev,
 
 static int pci230_ai_check_scan_period(struct comedi_cmd *cmd)
 {
-       unsigned int min_scan_period, chanlist_len;
+       unsigned int min_scan_period;
        int err = 0;
 
-       chanlist_len = cmd->chanlist_len;
-       if (cmd->chanlist_len == 0)
-               chanlist_len = 1;
-
-       min_scan_period = chanlist_len * cmd->convert_arg;
-       if ((min_scan_period < chanlist_len)
-           || (min_scan_period < cmd->convert_arg)) {
+       min_scan_period = cmd->chanlist_len * cmd->convert_arg;
+       if ((min_scan_period < cmd->chanlist_len) ||
+           (min_scan_period < cmd->convert_arg)) {
                /* Arithmetic overflow. */
                min_scan_period = UINT_MAX;
                err++;
@@ -1703,19 +1699,16 @@ static int pci230_ai_cmdtest(struct comedi_device *dev,
                unsigned int max_speed_ai;
 
                if (devpriv->hwver == 0) {
-                       /* PCI230 or PCI260.  Max speed depends whether
-                        * single-ended or pseudo-differential. */
-                       if (cmd->chanlist && (cmd->chanlist_len > 0)) {
-                               /* Peek analogue reference of first channel. */
-                               if (CR_AREF(cmd->chanlist[0]) == AREF_DIFF)
-                                       max_speed_ai = MAX_SPEED_AI_DIFF;
-                               else
-                                       max_speed_ai = MAX_SPEED_AI_SE;
-
-                       } else {
-                               /* No channel list.  Assume single-ended. */
+                       /*
+                        * PCI230 or PCI260.  Max speed depends whether
+                        * single-ended or pseudo-differential.
+                        *
+                        * Peek analogue reference of first channel.
+                        */
+                       if (CR_AREF(cmd->chanlist[0]) == AREF_DIFF)
+                               max_speed_ai = MAX_SPEED_AI_DIFF;
+                       else
                                max_speed_ai = MAX_SPEED_AI_SE;
-                       }
                } else {
                        /* PCI230+ or PCI260+. */
                        max_speed_ai = MAX_SPEED_AI_PLUS;
-- 
1.9.2

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

Reply via email to