From patchwork Tue Aug 22 19:51:26 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: 9916133 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 563F3603F9 for ; Tue, 22 Aug 2017 20:01:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 458EE288A2 for ; Tue, 22 Aug 2017 20:01:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A5AF2891F; Tue, 22 Aug 2017 20:01:28 +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 6C1FB28925 for ; Tue, 22 Aug 2017 20:01:27 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E4D17267028; Tue, 22 Aug 2017 21:51:39 +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 04DE0267029; Tue, 22 Aug 2017 21:51:38 +0200 (CEST) Received: from mout.web.de (mout.web.de [212.227.15.4]) by alsa0.perex.cz (Postfix) with ESMTP id 30240266998 for ; Tue, 22 Aug 2017 21:51:36 +0200 (CEST) Received: from [192.168.1.2] ([77.181.75.183]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MWBA1-1e4QdV3Znd-00XJRB; Tue, 22 Aug 2017 21:51:29 +0200 To: alsa-devel@alsa-project.org, Clemens Ladisch , Jaroslav Kysela , Takashi Iwai , Takashi Sakamoto From: SF Markus Elfring Message-ID: <05f76303-7370-ea37-20c2-116c04b850db@users.sourceforge.net> Date: Tue, 22 Aug 2017 21:51:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:2GKktrDAZlROy6TpPn1RdGD+azGx7M0GD/UwJ2fRdRh1DIw5X2s 5pizhFWd8OsPVwa/e8WKjW18eZUFGv3+E/wCIPvFfwqeboWS8fsMm4vp5vSa0qfunXhAdKE ad5a96ORDSAE/DyEmVWc6/2/fRqC3M3pp3LR84Flb8k/ALradOfCRd2mrDeHbTdaM5BA4/K CRTEuFEWFnMANnCjfcbbA== X-UI-Out-Filterresults: notjunk:1; V01:K0:9TI/Gmv+rXc=:BW90kClI9+CgIIkC6hQA4Y 98lFQ2TJWQKo2DYFZuAwjMZc5g61Fk1B2ou14Bd8sVWGOAac3U0fwwt7t7yXt5837kwqiSimD zxNi7VruV+zY5bwUxVYogNStWyWtM2YM7zhMl88BS3E3Ax4+Ovx/SE0rvWahIEMyS2kscOFJ9 k45KobElOhgZ432a5ngSi2goyCFJ60g8pm2TkXnBWThNrvQQON7gMRbaE8nAkiSbhOEEHbxNG rpq7hWZzrezaXNlU1sbB6IsnyBEZNRqCAj395UUou1RD9SnzlXw8fd9d3GpUPmHRT7+/MrOl5 ZBaWyjj9qLjXdcb4hEEodQgt9w2U+rQHEba87xGZK0Tz11VpqYabXZq0j9qW/pdpSuiCQAScl PprqANtc6Pc9XX1n9sib0rPR59LJ70NeEjBJSmwW9GBLYKibfJmwTF8hoQ+sGFmPYukDFZ/+J Un3A5kpBUAyS3DGI/TP6TJ7wb2NCJyJj505scShHOzmHO0C7QS7VVnVZ2E6cax+bbcaLLYvBM XRh+NqTYCk1l9MGpJVNCrEbmDMmlTmAtE8ufKCdyL2nYNJuNHsXezvozPCUvH1bGmk3Nu/Kyz bSGNuq68WPl0T1TkelVStKnJdBjdPyAIUD9Z/b/v9Yak/4aEXwgdpl+dzY9KV3PpUlLUpul4T Ra7EXGU2hQS4J3azuXzcTXIahEZGTqk5mExPa3U/fv0aVzlN6JWVEJac5gTVCPPartqLeqSnf 80T+NWG/q+XPRyaDwOYSMZXASkGNNnrhIj7E7LJUIrCcv6MVbhcnJGzxFSXGQ2OG7Z/YeX+aV 4VODDaGmrjLIlEb+I8tnxhPbSXD+8uMUnTZGhzGvchEqWUOCUuVEGJSxsgIyuOOMy05jZmb Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH] ALSA: Fireface: Use common error handling code in pcm_open() 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: Tue, 22 Aug 2017 21:45:42 +0200 Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- sound/firewire/fireface/ff-pcm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/firewire/fireface/ff-pcm.c b/sound/firewire/fireface/ff-pcm.c index d12a0e3a4219..40975395a64a 100644 --- a/sound/firewire/fireface/ff-pcm.c +++ b/sound/firewire/fireface/ff-pcm.c @@ -138,16 +138,12 @@ static int pcm_open(struct snd_pcm_substream *substream) return err; err = pcm_init_hw_params(ff, substream); - if (err < 0) { - snd_ff_stream_lock_release(ff); - return err; - } + if (err < 0) + goto release_lock; err = ff->spec->protocol->get_clock(ff, &rate, &src); - if (err < 0) { - snd_ff_stream_lock_release(ff); - return err; - } + if (err < 0) + goto release_lock; if (src != SND_FF_CLOCK_SRC_INTERNAL) { for (i = 0; i < CIP_SFC_COUNT; ++i) { @@ -177,6 +173,10 @@ static int pcm_open(struct snd_pcm_substream *substream) snd_pcm_set_sync(substream); return 0; + +release_lock: + snd_ff_stream_lock_release(ff); + return err; } static int pcm_close(struct snd_pcm_substream *substream)