From patchwork Sun Nov 19 20:20:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10065787 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 05D4D602B7 for ; Sun, 19 Nov 2017 20:21:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC66D28DAC for ; Sun, 19 Nov 2017 20:21:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE13929006; Sun, 19 Nov 2017 20:21:08 +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 36F6A28DAC for ; Sun, 19 Nov 2017 20:21:08 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1203C266E77; Sun, 19 Nov 2017 21:21:05 +0100 (CET) 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 3B089266E78; Sun, 19 Nov 2017 21:21:04 +0100 (CET) Received: from mout.web.de (mout.web.de [212.227.15.14]) by alsa0.perex.cz (Postfix) with ESMTP id 976BA266E76 for ; Sun, 19 Nov 2017 21:21:02 +0100 (CET) Received: from [192.168.1.3] ([92.225.173.18]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MJCEk-1eJGxn2wg6-002mEG; Sun, 19 Nov 2017 21:20:26 +0100 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Jaroslav Kysela , Liam Girdwood , Mark Brown , Takashi Iwai References: <54203404-1e40-3c97-a6e5-75a41ec3e742@users.sourceforge.net> Message-ID: <84ae04be-480e-6eba-0efc-52e7592b6e02@users.sourceforge.net> Date: Sun, 19 Nov 2017 21:20:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <54203404-1e40-3c97-a6e5-75a41ec3e742@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:+84e/iQKSu/b0k/Isihqr3wm8W39X/BBI9/E7/r+xkemn8nGUP1 mpkcVCmxu3dQOWy2ZGZRQZuIWN5v/huuOP+dTJ3jjWJr93vmyb4ZHREmITvV4qrvi2iGPos KvCjMU7ri1KE/mg92JPI8D/zkI6Aw2Wq1BQW8VSe/wakJ7qMAv5Ri+PfHxw6kEUvM58036A lHqM/44ZQH90L3ypCguGQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:UM5RZ+AMIys=:Cq3ZgnFGly2TqTkP2HLK0b Y6JYSul1QSyJKBfgbDOwa8TN+15J6qRCdDKW/ECfBY2gEJ+/kNvEG5YHRJPqQJ7zeD3TvirmK xxCwr7C3eNjlD/qWGGMhtoMw5daegJQsB83AAAQugFBXY/YjD9mvsTIvbjvHSUWW3PS//1vlb s2Nht6km5aMEtATAJa0l37/NfwRWSkEPmzQHHIvsVU5wBGTyggNfUAbN9L/le73RQOIFJq64O +YM9j8I8Eot37ylhuVV7cMmjv4QTMd4b1P7lWs1wFqkXwUYN6vWH40ki3Gh93aJsG69JDHgWe eDcef2LmqAOwrXP2NTMPysoIpySgbV42rMrvt6pLpQLHiEEPAIDd4zTxOk6YxYEnaNYJNrgbb LKCz2bRLGwCCWvOUmZAiZFjl5Fm+sx+1+Tkn4Ume6DmyZB+nBAwE75ySe7KhpHXByHXV3qIy+ w87PPZHtYhsADAgV0kdrAf4NDKMOvrvQGVlzqxGkcdXKCScOapxl8hrH7vuGDC2tjJchcFusv E8Yx+w2nslmy8RYwvXAX4rgT8/EUhJ8ESPkq7rUDUuIatS3welw79tGb1yCScJBgYY4tRGPUZ eEvOLxwcMYmNmytyzT9+KY60LW3It3XIeA3IO422DTPL6sHR1ARs6VNvu4fqNhy+5/3GyZuSw bIjbHls9Dh72gv0x/LxD7MB+Dc9kUnU1Roh04jZzSzuuhqkHDjRis4ilmUaaKVRAy93DEmdWt btc/298HEFbDo/8ln++o61dQCNxuUeFnZGRVf3Ds6D9N441ZfmiARi/HjwP2BVm4JOgu0+oEP ZWQh2JiclbEdI8NbMC9C5mJWdRh2GrjE5ncAG43JOsMyQU1zOE= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 1/4] ASoC: soc-pcm: Improve unlocking of a mutex in soc_dpcm_runtime_update() 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring 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 --- 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) {