From patchwork Wed Jul 13 14:15:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 9227785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6411260572 for ; Wed, 13 Jul 2016 15:00:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54DDE26220 for ; Wed, 13 Jul 2016 15:00:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 494A927F8E; Wed, 13 Jul 2016 15:00:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9880C26220 for ; Wed, 13 Jul 2016 15:00:26 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 68354266713; Wed, 13 Jul 2016 17:00:25 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id CB77B266534; Wed, 13 Jul 2016 16:56:30 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 16BE8266534; Wed, 13 Jul 2016 16:56:29 +0200 (CEST) Received: from smtp-proxy004.phy.lolipop.jp (smtp-proxy004.phy.lolipop.jp [157.7.104.45]) by alsa0.perex.cz (Postfix) with ESMTP id 79FD126680D for ; Wed, 13 Jul 2016 16:15:28 +0200 (CEST) Received: from smtp-proxy004.phy.lolipop.lan (HELO smtp-proxy004.phy.lolipop.jp) (172.19.44.45) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp-proxy004.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Wed, 13 Jul 2016 23:15:25 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp-proxy004.phy.lolipop.jp (LOLIPOP-Fsecure); Wed, 13 Jul 2016 23:15:24 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: tiwai@suse.de Date: Wed, 13 Jul 2016 23:15:23 +0900 Message-Id: <1468419323-15511-1-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.7.4 Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH] pcm: fix return value of snd_pcm_ioplug_sw_params() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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; }