summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/audio_codec.c
diff options
context:
space:
mode:
authorVaibhav Agarwal <vaibhav.agarwal@linaro.org>2016-08-04 15:14:28 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2016-08-04 19:07:30 +0200
commit90579d4b577154606a54cab9771e15a41867b79b (patch)
treeab0f0d87d5073848ce63b22fc499c05c264195b3 /drivers/staging/greybus/audio_codec.c
parent921dbe52b40b2573d9a0e8337c768930bef25fb4 (diff)
greybus: audio: Remove un-necessary goto statement
For most of the helper functions, goto statement is widely used. It was originally used with an intent of single exit point for the function with some cleanup required. This is no more the case. So, simplify code by avoiding un-necessary gotos. Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org> Reviewed-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/audio_codec.c')
-rw-r--r--drivers/staging/greybus/audio_codec.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index d7679e6bc364..9b98e9c282da 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -64,7 +64,8 @@ static int gbaudio_module_disable(struct gbaudio_codec_info *codec,
if (module_state == GBAUDIO_CODEC_SHUTDOWN) {
dev_dbg(codec->dev, "%s: module already configured\n",
module->name);
- goto func_exit;
+ mutex_unlock(&codec->lock);
+ return 0;
}
/* find the dai */
@@ -72,8 +73,8 @@ static int gbaudio_module_disable(struct gbaudio_codec_info *codec,
if (!data) {
dev_err(codec->dev, "%s:%s DATA connection missing\n",
dai_name, module->name);
- ret = -ENODEV;
- goto func_exit;
+ mutex_unlock(&codec->lock);
+ return -ENODEV;
}
if (codec_state > GBAUDIO_CODEC_HWPARAMS) {
data_cport = data->connection->intf_cport_id;
@@ -162,7 +163,8 @@ static int gbaudio_module_enable(struct gbaudio_codec_info *codec,
if (module_state == codec_state) {
dev_dbg(codec->dev, "%s: module already configured\n",
module->name);
- goto func_exit;
+ mutex_unlock(&codec->lock);
+ return 0;
}
/* find the dai */
@@ -170,8 +172,8 @@ static int gbaudio_module_enable(struct gbaudio_codec_info *codec,
if (!data) {
dev_err(codec->dev, "%s:%s DATA connection missing\n",
dai_name, module->name);
- ret = -ENODEV;
- goto func_exit;
+ mutex_unlock(&codec->lock);
+ return -ENODEV;
}
/* register cport */
@@ -754,8 +756,8 @@ static int gbcodec_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
if (!data) {
dev_err(dai->dev, "%s:%s DATA connection missing\n",
dai->name, module->name);
- ret = -ENODEV;
- goto func_exit;
+ mutex_unlock(&codec->lock);
+ return -ENODEV;
}
if (!mute && !stream) {/* start playback */
@@ -792,9 +794,8 @@ static int gbcodec_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
module->name, mute ? "Mute" : "Unmute",
stream ? "Capture" : "Playback", ret);
-func_exit:
mutex_unlock(&codec->lock);
- return 0;
+ return ret;
}
static struct snd_soc_dai_ops gbcodec_dai_ops = {