From fd9fe1fc1cd4771eff4666379b915661d7a4f0d2 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 24 Aug 2015 10:13:56 -0700 Subject: [PATCH] staging: comedi: usbduxfast: remove impossible 'if (!devpriv)' checks 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- 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 a8635b1659a4..cb221e7ab60e 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.39.5