lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84ae04be-480e-6eba-0efc-52e7592b6e02@users.sourceforge.net>
Date:   Sun, 19 Nov 2017 21:20:19 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     alsa-devel@...a-project.org, Jaroslav Kysela <perex@...ex.cz>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>, Takashi Iwai <tiwai@...e.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 1/4] ASoC: soc-pcm: Improve unlocking of a mutex in
 soc_dpcm_runtime_update()

From: Markus Elfring <elfring@...rs.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@...rs.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ