From: SF Markus Elfring <elfring@users.sourceforge.net>
To: alsa-devel@alsa-project.org, Jaroslav Kysela <perex@perex.cz>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Takashi Iwai <tiwai@suse.com>
Cc: kernel-janitors@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/4] ASoC: soc-pcm: Improve unlocking of a mutex in soc_dpcm_runtime_update()
Date: Sun, 19 Nov 2017 21:20:19 +0100 [thread overview]
Message-ID: <84ae04be-480e-6eba-0efc-52e7592b6e02@users.sourceforge.net> (raw)
In-Reply-To: <54203404-1e40-3c97-a6e5-75a41ec3e742@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 19 Nov 2017 19:43:07 +0100
* Add a jump target so that a call of the function "mutex_unlock" is stored
only once in this function implementation.
* Replace two calls by goto statements.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/soc/soc-pcm.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 8075856668c2..ea771316afa9 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2674,8 +2674,7 @@ int soc_dpcm_runtime_update(struct snd_soc_card *card)
if (paths < 0) {
dev_warn(fe->dev, "ASoC: %s no valid %s path\n",
fe->dai_link->name, "playback");
- mutex_unlock(&card->mutex);
- return paths;
+ goto unlock;
}
/* update any new playback paths */
@@ -2710,8 +2709,7 @@ int soc_dpcm_runtime_update(struct snd_soc_card *card)
if (paths < 0) {
dev_warn(fe->dev, "ASoC: %s no valid %s path\n",
fe->dai_link->name, "capture");
- mutex_unlock(&card->mutex);
- return paths;
+ goto unlock;
}
/* update any new capture paths */
@@ -2733,8 +2731,10 @@ int soc_dpcm_runtime_update(struct snd_soc_card *card)
dpcm_path_put(&list);
}
+ paths = 0;
+unlock:
mutex_unlock(&card->mutex);
- return 0;
+ return paths;
}
int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute)
{
--
2.15.0
next prev parent reply other threads:[~2017-11-19 20:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-19 20:17 [PATCH 0/4] ALSA SoC PCM: Fine-tuning for some function implementations SF Markus Elfring
2017-11-19 20:20 ` SF Markus Elfring [this message]
2017-11-19 20:21 ` [PATCH 2/4] ASoC: soc-pcm: Add some blank lines for better code readability SF Markus Elfring
2017-11-19 20:22 ` [PATCH 3/4] ASoC: soc-pcm: Add some spaces " SF Markus Elfring
2017-11-19 20:24 ` [PATCH 4/4] ASoC: soc-pcm: Improve a size determination in dpcm_be_connect() SF Markus Elfring
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=84ae04be-480e-6eba-0efc-52e7592b6e02@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/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).