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 <hswee...@visionengravers.com>
Cc: Ian Abbott <abbo...@mev.co.uk>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/staging/comedi/drivers/usbduxfast.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index a8635b1..cb221e7 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -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");
-- 
2.4.3

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

Reply via email to