All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: [alsa-devel] [PATCH v3 08/18] ASoC: soc-pcm: use goto and remove multi return
Date: 17 Feb 2020 11:16:09 +0900	[thread overview]
Message-ID: <87zhdi9cx4.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87blpyarja.wl-kuninori.morimoto.gx@renesas.com>


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

When we use some kind of lock, we need to do unlock.
In that time, multi unlock/return is not good implementation.
This patch add label and use goto at dpcm_fe_dai_open()
to reduce such code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 sound/soc/soc-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index fcebc327c0ef..bf1f74c42e1a 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2733,8 +2733,7 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
 
 	ret = dpcm_path_get(fe, stream, &list);
 	if (ret < 0) {
-		mutex_unlock(&fe->card->mutex);
-		return ret;
+		goto open_end;
 	} else if (ret == 0) {
 		dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
 			fe->dai_link->name, stream ? "capture" : "playback");
@@ -2755,6 +2754,7 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
 
 	dpcm_clear_pending_state(fe, stream);
 	dpcm_path_put(&list);
+open_end:
 	mutex_unlock(&fe->card->mutex);
 	return ret;
 }
-- 
2.17.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2020-02-17  2:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-17  2:15 [alsa-devel] [PATCH v3 00/18] ASoC: soc-pcm cleanup step3 Kuninori Morimoto
2020-02-17  2:15 ` [alsa-devel] [PATCH v3 01/18] ASoC: soc-pcm: move dai_get_widget() Kuninori Morimoto
2020-02-17  2:15 ` [alsa-devel] [PATCH v3 02/18] ASoC: soc-pcm: use dai_get_widget() at dpcm_get_be() Kuninori Morimoto
2020-02-17  2:15 ` [alsa-devel] [PATCH v3 03/18] ASoC: soc-pcm: use dai_get_widget() at dpcm_end_walk_at_be() Kuninori Morimoto
2020-02-17  2:15 ` [alsa-devel] [PATCH v3 04/18] ASoC: soc-pcm: use dpcm_get_be() " Kuninori Morimoto
2020-02-17  2:15 ` [alsa-devel] [PATCH v3 05/18] ASoC: soc-pcm: remove soc_dpcm_be_digital_mute() Kuninori Morimoto
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 06/18] ASoC: soc-pcm: remove snd_soc_dpcm_be_get/set_state() Kuninori Morimoto
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 07/18] ASoC: soc-pcm: add snd_soc_dpcm_can_be() and remove duplicate code Kuninori Morimoto
2020-02-17  2:16 ` Kuninori Morimoto [this message]
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 09/18] ASoC: soc-pcm: merge playback/cature_active into stream_active Kuninori Morimoto
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 10/18] ASoC: soc.h: add for_each_pcm_streams() Kuninori Morimoto
2020-02-17  7:55   ` Takashi Iwai
2020-02-17  8:24     ` Kuninori Morimoto
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 11/18] ASoC: soc-core: use for_each_pcm_streams() macro Kuninori Morimoto
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 12/18] ASoC: soc-pcm: " Kuninori Morimoto
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 13/18] ASoC: soc-generic-dmaengine-pcm: " Kuninori Morimoto
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 14/18] ASoC: dwc: dwc-i2s: " Kuninori Morimoto
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 15/18] ASoC: fsl: fsl_asrc_dma: " Kuninori Morimoto
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 16/18] ASoC: qcom: lpass-platform: " Kuninori Morimoto
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 17/18] ASoC: sof: sof-audio: " Kuninori Morimoto
2020-02-17  2:16 ` [alsa-devel] [PATCH v3 18/18] ALSA: usx2y: " Kuninori Morimoto
2020-02-17  7:55   ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zhdi9cx4.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.