Commit d6610a50 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

Staging: comedi: unlock on error in usbdux_ao_inttrig()

If we had an invalid trignum (anything other than zero is invalid) then
we returned without unlocking.  I've modified this function to just have
one return point.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2d2c880f
...@@ -1523,15 +1523,17 @@ static int usbdux_ao_inttrig(struct comedi_device *dev, ...@@ -1523,15 +1523,17 @@ static int usbdux_ao_inttrig(struct comedi_device *dev,
return -EFAULT; return -EFAULT;
down(&this_usbduxsub->sem); down(&this_usbduxsub->sem);
if (!(this_usbduxsub->probed)) { if (!(this_usbduxsub->probed)) {
up(&this_usbduxsub->sem); ret = -ENODEV;
return -ENODEV; goto out;
} }
if (trignum != 0) { if (trignum != 0) {
dev_err(&this_usbduxsub->interface->dev, dev_err(&this_usbduxsub->interface->dev,
"comedi%d: usbdux_ao_inttrig: invalid trignum\n", "comedi%d: usbdux_ao_inttrig: invalid trignum\n",
dev->minor); dev->minor);
return -EINVAL; ret = -EINVAL;
goto out;
} }
if (!(this_usbduxsub->ao_cmd_running)) { if (!(this_usbduxsub->ao_cmd_running)) {
this_usbduxsub->ao_cmd_running = 1; this_usbduxsub->ao_cmd_running = 1;
...@@ -1541,8 +1543,7 @@ static int usbdux_ao_inttrig(struct comedi_device *dev, ...@@ -1541,8 +1543,7 @@ static int usbdux_ao_inttrig(struct comedi_device *dev,
"comedi%d: usbdux_ao_inttrig: submitURB: " "comedi%d: usbdux_ao_inttrig: submitURB: "
"err=%d\n", dev->minor, ret); "err=%d\n", dev->minor, ret);
this_usbduxsub->ao_cmd_running = 0; this_usbduxsub->ao_cmd_running = 0;
up(&this_usbduxsub->sem); goto out;
return ret;
} }
s->async->inttrig = NULL; s->async->inttrig = NULL;
} else { } else {
...@@ -1550,8 +1551,10 @@ static int usbdux_ao_inttrig(struct comedi_device *dev, ...@@ -1550,8 +1551,10 @@ static int usbdux_ao_inttrig(struct comedi_device *dev,
"comedi%d: ao_inttrig but acqu is already running.\n", "comedi%d: ao_inttrig but acqu is already running.\n",
dev->minor); dev->minor);
} }
ret = 1;
out:
up(&this_usbduxsub->sem); up(&this_usbduxsub->sem);
return 1; return ret;
} }
static int usbdux_ao_cmdtest(struct comedi_device *dev, static int usbdux_ao_cmdtest(struct comedi_device *dev,
......
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