From f4e694d54e2b9784841602216193534d0710997c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Jun 2013 16:16:25 -0700 Subject: [PATCH] staging: comedi: addi_apci_3xxx: remove sanity checks in i_APCI3XXX_InsnReadAnalogInput() The comedi core validates the insn->chanspec channel and range before calling the subdevice (*insn_read) function. Remove the unnecessary sanity checks. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3xxx.c | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c index a6142abdaeeb..dbe7a90858db 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c @@ -314,7 +314,6 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - const struct apci3xxx_boardinfo *this_board = comedi_board(dev); struct apci3xxx_private *devpriv = dev->private; int i_ReturnValue = insn->n; unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec); @@ -324,41 +323,6 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, unsigned int dw_AcquisitionCpt = 0; unsigned char b_Interrupt = 0; - /***************************/ - /* Test the channel number */ - /***************************/ - - if (((b_Channel < this_board->i_NbrAiChannel) - && (devpriv->b_SingelDiff == APCI3XXX_SINGLE)) - || ((b_Channel < this_board->i_NbrAiChannelDiff) - && (devpriv->b_SingelDiff == APCI3XXX_DIFF))) { - /**********************************/ - /* Test the channel configuration */ - /**********************************/ - - if (b_Configuration > 7) { - /***************************/ - /* Channel not initialised */ - /***************************/ - - i_ReturnValue = -4; - printk("Channel %d range %d selection error\n", - b_Channel, b_Configuration); - } - } else { - /***************************/ - /* Channel selection error */ - /***************************/ - - i_ReturnValue = -3; - printk("Channel %d selection error\n", b_Channel); - } - - /**************************/ - /* Test if no error occur */ - /**************************/ - - if (i_ReturnValue >= 0) { /************************/ /* Test the buffer size */ /************************/ @@ -493,7 +457,6 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, printk("Buffer size error\n"); i_ReturnValue = -101; } - } return i_ReturnValue; } -- 2.39.5