aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2015-08-24 10:14:02 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-09-12 18:24:25 -0700
commit7b0fc5baa0bd75fa04cd784828d7d072fb905144 (patch)
tree23382c17601722f8abade91f99f6a3de988b1c3c
parentstaging: comedi: usbduxfast: tidy up the conversion timing validation (diff)
staging: comedi: usbduxfast: use a common exit path in ai (*do_cmd)
For aesthetics, use 'goto' and a common exit point in this function so that the up of the semaphore is not overlooked. 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>
-rw-r--r--drivers/staging/comedi/drivers/usbduxfast.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
index ae775964c7d5..60f1c5e15a6a 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -470,14 +470,12 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
struct comedi_cmd *cmd = &s->async->cmd;
unsigned int rngmask = 0xff;
int j, ret;
- int result;
long steps, steps_tmp;
down(&devpriv->sem);
if (devpriv->ai_cmd_running) {
- dev_err(dev->class_dev, "ai_cmd not possible\n");
- up(&devpriv->sem);
- return -EBUSY;
+ ret = -EBUSY;
+ goto cmd_exit;
}
/*
@@ -734,11 +732,9 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
}
/* 0 means that the AD commands are sent */
- result = usbduxfast_send_cmd(dev, SENDADCOMMANDS);
- if (result < 0) {
- up(&devpriv->sem);
- return result;
- }
+ ret = usbduxfast_send_cmd(dev, SENDADCOMMANDS);
+ if (ret < 0)
+ goto cmd_exit;
if ((cmd->start_src == TRIG_NOW) || (cmd->start_src == TRIG_EXT)) {
/* enable this acquisition operation */
@@ -747,16 +743,17 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
if (ret < 0) {
devpriv->ai_cmd_running = 0;
/* fixme: unlink here?? */
- up(&devpriv->sem);
- return ret;
+ goto cmd_exit;
}
s->async->inttrig = NULL;
} else { /* TRIG_INT */
s->async->inttrig = usbduxfast_ai_inttrig;
}
+
+cmd_exit:
up(&devpriv->sem);
- return 0;
+ return ret;
}
/*