Commit db1876ff authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: usbduxfast: only chanlist of 1, 2, 3, or 16 are supported

The analog input (*do_cmd) only supports channel lists of 1, 2, 3, or 16
channels. Add a check for this to usbduxfast_ai_check_chanlist() and remove
the check from usbduxfast_ai_cmd().
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 99555fc2
...@@ -339,6 +339,11 @@ static int usbduxfast_ai_check_chanlist(struct comedi_device *dev, ...@@ -339,6 +339,11 @@ static int usbduxfast_ai_check_chanlist(struct comedi_device *dev,
unsigned int gain0 = CR_RANGE(cmd->chanlist[0]); unsigned int gain0 = CR_RANGE(cmd->chanlist[0]);
int i; int i;
if (cmd->chanlist_len > 3 && cmd->chanlist_len != 16) {
dev_err(dev->class_dev, "unsupported combination of channels\n");
return -EINVAL;
}
for (i = 0; i < cmd->chanlist_len; ++i) { for (i = 0; i < cmd->chanlist_len; ++i) {
unsigned int chan = CR_CHAN(cmd->chanlist[i]); unsigned int chan = CR_CHAN(cmd->chanlist[i]);
unsigned int gain = CR_RANGE(cmd->chanlist[i]); unsigned int gain = CR_RANGE(cmd->chanlist[i]);
...@@ -779,11 +784,6 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev, ...@@ -779,11 +784,6 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
usbduxfast_cmd_data(dev, 4, 0x09, 0x01, rngmask, 0xff); usbduxfast_cmd_data(dev, 4, 0x09, 0x01, rngmask, 0xff);
break; break;
default:
dev_err(dev->class_dev, "unsupported combination of channels\n");
up(&devpriv->sem);
return -EFAULT;
} }
/* 0 means that the AD commands are sent */ /* 0 means that the AD commands are sent */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment