alsa-devel.alsa-project.org archive mirror
 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 v2 08/10] ASoC: soc-pcm: use goto and remove multi return
Date: 14 Feb 2020 11:35:58 +0900	[thread overview]
Message-ID: <87h7ztzyih.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87sgjdzyk4.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>
---
v1 -> v2

	- no change

 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-14  2:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14  2:35 [alsa-devel] [PATCH v2 00/10] ASoC: soc-pcm cleanup step3 Kuninori Morimoto
2020-02-14  2:35 ` [alsa-devel] [PATCH v2 01/10] ASoC: soc-pcm: move dai_get_widget() Kuninori Morimoto
2020-02-14  2:35 ` [alsa-devel] [PATCH v2 02/10] ASoC: soc-pcm: use dai_get_widget() at dpcm_get_be() Kuninori Morimoto
2020-02-14  2:35 ` [alsa-devel] [PATCH v2 03/10] ASoC: soc-pcm: use dai_get_widget() at dpcm_end_walk_at_be() Kuninori Morimoto
2020-02-14  2:35 ` [alsa-devel] [PATCH v2 04/10] ASoC: soc-pcm: use dpcm_get_be() " Kuninori Morimoto
2020-02-14  2:35 ` [alsa-devel] [PATCH v2 05/10] ASoC: soc-pcm: remove soc_dpcm_be_digital_mute() Kuninori Morimoto
2020-02-14  2:35 ` [alsa-devel] [PATCH v2 06/10] ASoC: soc-pcm: remove snd_soc_dpcm_be_get/set_state() Kuninori Morimoto
2020-02-14  2:35 ` [alsa-devel] [PATCH v2 07/10] ASoC: soc-pcm: add snd_soc_dpcm_can_be() and remove duplicate code Kuninori Morimoto
2020-02-14  2:35 ` Kuninori Morimoto [this message]
2020-02-14  2:36 ` [alsa-devel] [PATCH v2 09/10] ASoC: soc-pcm: merge playback/cature_active into stream_active Kuninori Morimoto
2020-02-14  2:36 ` [alsa-devel] [PATCH v2 10/10] ASoC: soc.h: add for_each_pcm_streams() Kuninori Morimoto
2020-02-14 14:32   ` Pierre-Louis Bossart
2020-02-16 23:59     ` Kuninori Morimoto
2020-02-14 17:10 ` [alsa-devel] [PATCH v2 00/10] ASoC: soc-pcm cleanup step3 Ranjani Sridharan

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=87h7ztzyih.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).