pcm: fix return value of snd_pcm_ioplug_sw_params()
diff mbox

Message ID 1468419323-15511-1-git-send-email-o-takashi@sakamocchi.jp
State New
Headers show

Commit Message

Takashi Sakamoto July 13, 2016, 2:15 p.m. UTC
In former commits for thread-safe PCM APIs, snd_pcm_ioplug_sw_params() got
0 as its return value, against the original implementation.

This commit fixes it.

Fixes: 54931e5a5455('pcm: Add thread-safety to PCM API')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 src/pcm/pcm_ioplug.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Comments

Takashi Iwai July 13, 2016, 2:37 p.m. UTC | #1
On Wed, 13 Jul 2016 16:15:23 +0200,
Takashi Sakamoto wrote:
> 
> In former commits for thread-safe PCM APIs, snd_pcm_ioplug_sw_params() got
> 0 as its return value, against the original implementation.
> 
> This commit fixes it.
> 
> Fixes: 54931e5a5455('pcm: Add thread-safety to PCM API')
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Thanks, applied this one, too.


Takashi

Patch
diff mbox

diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
index 115d89b..1dc198e 100644
--- a/src/pcm/pcm_ioplug.c
+++ b/src/pcm/pcm_ioplug.c
@@ -434,14 +434,16 @@  static int snd_pcm_ioplug_hw_free(snd_pcm_t *pcm)
 static int snd_pcm_ioplug_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
 {
 	ioplug_priv_t *io = pcm->private_data;
-	int err = 0;
+	int err;
 
-	if (io->data->callback->sw_params) {
-		snd_pcm_unlock(pcm); /* to avoid deadlock */
-		err = io->data->callback->sw_params(io->data, params);
-		snd_pcm_lock(pcm);
-	}
-	return 0;
+	if (!io->data->callback->sw_params)
+		return 0;
+
+	snd_pcm_unlock(pcm); /* to avoid deadlock */
+	err = io->data->callback->sw_params(io->data, params);
+	snd_pcm_lock(pcm);
+
+	return err;
 }