All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: tiwai@suse.de
Cc: alsa-devel@alsa-project.org
Subject: [PATCH] pcm: fix return value of snd_pcm_ioplug_sw_params()
Date: Wed, 13 Jul 2016 23:15:23 +0900	[thread overview]
Message-ID: <1468419323-15511-1-git-send-email-o-takashi@sakamocchi.jp> (raw)

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(-)

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;
 }
 
 
-- 
2.7.4

             reply	other threads:[~2016-07-13 14:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13 14:15 Takashi Sakamoto [this message]
2016-07-13 14:37 ` [PATCH] pcm: fix return value of snd_pcm_ioplug_sw_params() 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=1468419323-15511-1-git-send-email-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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.