From patchwork Wed Sep 6 11:35:51 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: 9940447 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 7A82060350 for ; Wed, 6 Sep 2017 11:36:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69C1E28B97 for ; Wed, 6 Sep 2017 11:36:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D7C928BA7; Wed, 6 Sep 2017 11:36:10 +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 86C5D28B97 for ; Wed, 6 Sep 2017 11:36:09 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B14DD2673B9; Wed, 6 Sep 2017 13:36:06 +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 393372673CE; Wed, 6 Sep 2017 13:36:05 +0200 (CEST) Received: from mout.web.de (mout.web.de [212.227.15.3]) by alsa0.perex.cz (Postfix) with ESMTP id 6D5DD266E02 for ; Wed, 6 Sep 2017 13:36:03 +0200 (CEST) Received: from [192.168.1.2] ([77.182.162.119]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LvS9z-1dOABN3Xtb-010a82; Wed, 06 Sep 2017 13:35:54 +0200 To: alsa-devel@alsa-project.org, Clemens Ladisch , Jaroslav Kysela , Takashi Iwai , Takashi Sakamoto From: SF Markus Elfring Message-ID: <9f50358a-0357-82ec-ee38-deae60eb53e9@users.sourceforge.net> Date: Wed, 6 Sep 2017 13:35:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:F3Audg2QMsFYnzpmWw3mnZuEaLuK+eGFhGcaZU4jy1MULRNLe/s 7IBCT8WdxGud3W+3GN7ZXRCAuFsj2houVVnJymkIyRSy04Y45IYePofqhG8cG5QnRjthWTP vhtZ2fFjBlqqcbKkvU69aXPWcGPzBh5J70rWaSZDmkvsNDmXnYOroyK2NbCQ6//WQ1R9gWn 2JrGxYMPN8Rccz1kEQTXw== X-UI-Out-Filterresults: notjunk:1; V01:K0:cndJtFypjuY=:df79zcLwYLZO5bdYigfj1Y 0ZV2WqMhf+uvP+/45AhvqfK9qY+BfJxF6UfyNaHA5kmbxXmJSAQxwWdfZ44n8CmeirZSJOtAK 5OsKBpcyMHwDrZJ7eNEpuDHCzgT1qfqXeKJDc18n5oXFLJ1IzDVu6fublsodJ3iObrGJ2TIr1 kf9LbrHO7MGRK3xRxLsapat8MCq3xP8tqdNDzoApCJeo2M4pSQ9PrVmTQU6oGEIrsWdqj/rGP hqzAAgzq/Cwj0OvxlqIhHsUq/wKJx48JtrI+R85kDJCzHzXhq8LsOE4ewLBWmrnmdswY8Hbex 0GJFvtRqX7iP2D9mtfEEFlPGgUr3Fu+5UZKpXDc0ueYHBj4GTG3OuMUHvsnBgZ6XzTRWZlCE3 j7KsSVhbp9Ic19fwfDrAcgTzQBKaZZfhkIpMs0qkvzxc0cwz2JXWdiT51/bWyn1P/qj9UrUmU 3O55+uvA36HVXSDQLzat3qYTcS3dVhxjaQuJ5bKyFVnlSOSnoX+0H591uBu9gi8i/RN+uViDf xsBwEH1J0ToiVReLG/l60yEFvFmRb8zN22YECJ4MqMFs+14YDOeGOHh2oEyiRCmw04tEhTntV TuHJ1warFGKjBpX5Z5XSPaFs2bXOnThEQJfjfbHm4A+HaGDhOsKDMl5Fu2pOs+iTCB0wO/cOs iJzp22mcZ528/2KJSaAY/YQbiqJa9mp0y+LTTyKCgXWee87d+yRcFMKErQGLSCg55rjpkoE+2 FY8qOYgeamljN/ARbFZ6D+VS2u9EYiQn9EH6EUri4wkMyyMe2eCkKvGznWbdLlBVKPEhTYz2+ Dy8+ALeNDTIE9O4tIwkViOPxmFsH2B8048myCQS3OspOR4QB5E= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH] ALSA: FireWire-MOTU: Use common error handling code in snd_motu_stream_start_duplex() 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: Wed, 6 Sep 2017 13:30:14 +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/motu/motu-stream.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/firewire/motu/motu-stream.c b/sound/firewire/motu/motu-stream.c index dc5541c8b359..73e7a5e527fc 100644 --- a/sound/firewire/motu/motu-stream.c +++ b/sound/firewire/motu/motu-stream.c @@ -253,24 +253,21 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate) if (err < 0) { dev_err(&motu->unit->device, "fail to start isochronous comm: %d\n", err); - stop_both_streams(motu); - return err; + goto stop_streams; } err = start_isoc_ctx(motu, &motu->rx_stream); if (err < 0) { dev_err(&motu->unit->device, "fail to start IT context: %d\n", err); - stop_both_streams(motu); - return err; + goto stop_streams; } err = protocol->switch_fetching_mode(motu, true); if (err < 0) { dev_err(&motu->unit->device, "fail to enable frame fetching: %d\n", err); - stop_both_streams(motu); - return err; + goto stop_streams; } } @@ -281,12 +278,15 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate) dev_err(&motu->unit->device, "fail to start IR context: %d", err); amdtp_stream_stop(&motu->rx_stream); - stop_both_streams(motu); - return err; + goto stop_streams; } } return 0; + +stop_streams: + stop_both_streams(motu); + return err; } void snd_motu_stream_stop_duplex(struct snd_motu *motu)