staging: comedi: usbduxfast: remove impossible 'if (!devpriv)' checks
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 24 Aug 2015 17:13:56 +0000 (10:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Sep 2015 01:24:24 +0000 (18:24 -0700)
The private data 'devpriv' is allocated in the (*auto_attach) before
the subdevices are initialized and the (*auto_attach) has to complete
successfully before the core will call any of the subdevice operations.
Because of this the (!devpriv) checks in the subdevice code can never
fail. Remove them.

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/usbduxfast.c

index a8635b1..cb221e7 100644 (file)
@@ -223,9 +223,6 @@ static int usbduxfast_ai_cancel(struct comedi_device *dev,
        struct usbduxfast_private *devpriv = dev->private;
        int ret;
 
-       if (!devpriv)
-               return -EFAULT;
-
        down(&devpriv->sem);
        ret = usbduxfast_ai_stop(dev, 1);
        up(&devpriv->sem);
@@ -317,9 +314,6 @@ static int usbduxfast_submit_urb(struct comedi_device *dev)
        struct usbduxfast_private *devpriv = dev->private;
        int ret;
 
-       if (!devpriv)
-               return -EFAULT;
-
        usb_fill_bulk_urb(devpriv->urb, usb, usb_rcvbulkpipe(usb, BULKINEP),
                          devpriv->inbuf, SIZEINBUF,
                          usbduxfast_ai_interrupt, dev);
@@ -466,9 +460,6 @@ static int usbduxfast_ai_inttrig(struct comedi_device *dev,
        struct comedi_cmd *cmd = &s->async->cmd;
        int ret;
 
-       if (!devpriv)
-               return -EFAULT;
-
        if (trig_num != cmd->start_arg)
                return -EINVAL;
 
@@ -501,9 +492,6 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
        int result;
        long steps, steps_tmp;
 
-       if (!devpriv)
-               return -EFAULT;
-
        down(&devpriv->sem);
        if (devpriv->ai_cmd_running) {
                dev_err(dev->class_dev, "ai_cmd not possible\n");