aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2011-11-30 03:42:21 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-08 15:29:39 -0500
commitd6610a502738e23aab5418e82c024be201e13f02 (patch)
tree7943e774152cce493b4514cc7697a56ec108b1de
parent2d2c880f8c16f4047cb642a5843ca6fa56f0d2a6 (diff)
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: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/comedi/drivers/usbduxsigma.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c
index a8fea9a91733..f4025b60cd3f 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -1523,15 +1523,17 @@ static int usbdux_ao_inttrig(struct comedi_device *dev,
1523 return -EFAULT; 1523 return -EFAULT;
1524 1524
1525 down(&this_usbduxsub->sem); 1525 down(&this_usbduxsub->sem);
1526
1526 if (!(this_usbduxsub->probed)) { 1527 if (!(this_usbduxsub->probed)) {
1527 up(&this_usbduxsub->sem); 1528 ret = -ENODEV;
1528 return -ENODEV; 1529 goto out;
1529 } 1530 }
1530 if (trignum != 0) { 1531 if (trignum != 0) {
1531 dev_err(&this_usbduxsub->interface->dev, 1532 dev_err(&this_usbduxsub->interface->dev,
1532 "comedi%d: usbdux_ao_inttrig: invalid trignum\n", 1533 "comedi%d: usbdux_ao_inttrig: invalid trignum\n",
1533 dev->minor); 1534 dev->minor);
1534 return -EINVAL; 1535 ret = -EINVAL;
1536 goto out;
1535 } 1537 }
1536 if (!(this_usbduxsub->ao_cmd_running)) { 1538 if (!(this_usbduxsub->ao_cmd_running)) {
1537 this_usbduxsub->ao_cmd_running = 1; 1539 this_usbduxsub->ao_cmd_running = 1;
@@ -1541,8 +1543,7 @@ static int usbdux_ao_inttrig(struct comedi_device *dev,
1541 "comedi%d: usbdux_ao_inttrig: submitURB: " 1543 "comedi%d: usbdux_ao_inttrig: submitURB: "
1542 "err=%d\n", dev->minor, ret); 1544 "err=%d\n", dev->minor, ret);
1543 this_usbduxsub->ao_cmd_running = 0; 1545 this_usbduxsub->ao_cmd_running = 0;
1544 up(&this_usbduxsub->sem); 1546 goto out;
1545 return ret;
1546 } 1547 }
1547 s->async->inttrig = NULL; 1548 s->async->inttrig = NULL;
1548 } else { 1549 } else {
@@ -1550,8 +1551,10 @@ static int usbdux_ao_inttrig(struct comedi_device *dev,
1550 "comedi%d: ao_inttrig but acqu is already running.\n", 1551 "comedi%d: ao_inttrig but acqu is already running.\n",
1551 dev->minor); 1552 dev->minor);
1552 } 1553 }
1554 ret = 1;
1555out:
1553 up(&this_usbduxsub->sem); 1556 up(&this_usbduxsub->sem);
1554 return 1; 1557 return ret;
1555} 1558}
1556 1559
1557static int usbdux_ao_cmdtest(struct comedi_device *dev, 1560static int usbdux_ao_cmdtest(struct comedi_device *dev,