diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2016-07-13 23:15:23 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-07-13 16:37:01 +0200 |
commit | 941bd150bef2560f3e38a3bf74d546447e3126d1 (patch) | |
tree | 02ac668de8f88f32abe0bf0a518f3cd394d6bd49 /src | |
parent | 4c124b07599b9b6538955c50e3b96bf4e3465bb9 (diff) | |
download | alsa-lib-941bd150bef2560f3e38a3bf74d546447e3126d1.tar.gz |
pcm: fix return value of snd_pcm_ioplug_sw_params()
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/pcm/pcm_ioplug.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c index 115d89bc..1dc198e7 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; } |