From patchwork Mon Aug 14 20:10:10 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: 9900019 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 96BEA602D9 for ; Mon, 14 Aug 2017 20:10:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78A3B286C7 for ; Mon, 14 Aug 2017 20:10:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D320286E2; Mon, 14 Aug 2017 20:10:30 +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 CA30C286C7 for ; Mon, 14 Aug 2017 20:10:29 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DD0AB267398; Mon, 14 Aug 2017 22:10:26 +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 B76EF267399; Mon, 14 Aug 2017 22:10:25 +0200 (CEST) Received: from mout.web.de (mout.web.de [217.72.192.78]) by alsa0.perex.cz (Postfix) with ESMTP id E1707267390 for ; Mon, 14 Aug 2017 22:10:23 +0200 (CEST) Received: from [192.168.1.2] ([92.224.124.39]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LbJCQ-1dImIm33yk-00kuhf; Mon, 14 Aug 2017 22:10:14 +0200 To: alsa-devel@alsa-project.org, Jaroslav Kysela , Julia Lawall , Takashi Iwai , Takashi Sakamoto From: SF Markus Elfring Message-ID: Date: Mon, 14 Aug 2017 22:10:10 +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:1zKavMEMSfRJX1R+xesHg9tQi085p4A0C/rFRtmRTW7Pzt5O/qC iMD+8LzlnwcvmtFfgdhXNtnHrM7pD5TOWGIAklZwYw3uvxzS8OulHVI02l7LW0mYCGOfQMW PWpAhs/w6FL5dXdtGgwEGm/vCfLQjzLCSAa4Ms40aPy4HcmpP3ZjVsulQ6qw4NdqOiTZIzs uVxyWYpB2ItGxTS8W942Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:VTyYNd7yUsU=:gSNATH3M5GVRrjdfuZaCmg 9fhe80AlW1YMPi5F0CnphL34w8+IohsJU8yf/5xG8ocMIVUFqTzOfY1QM9pf1QGAXRily7y/u Ca6TY/fxo5GhSXl/YBmS+eHhlEqLt2Xnj/Px2puegPJEFvWX1uMNRnbC4dHKvA8RhGj5ZGMqK NCMbEiqj32UdxnQYERRaQJYOzjLsiUUu8GOcaNck3Gxk3yypmpdFw79Xo20uxzK9iCqF6bnOL Hwwpw3Iluj0kyanqE5onnVC6EuW8HmJunCF49UYoLZq594A5Q07GxtV0d0C0Fy0q3sjMm6AOQ Jg2IqJXoVbo5xIoRJ5rh/1DOQtEVfE0naIfdP+zT4X9c6pX+d1GFbgkNhducF0n4Ku5mSp2MZ UX/j5SF+nbHkf8+r8DbpBczf5b+fJf9Jbvo1Um78xglWpgLnHR9TprCr8OH7WmMEXPpi9TgPT 7bys38FEibnr9cUm4kawjibF+n0JV4kYkcI6DIX/gwmnJR4i1X2ZnWGlRCQVGst55yG1LB/FV b1u9cVW0XCuMIbegzGyg7he4t6jPYhYf4XQuN7KaSCyY1XMSZcPg30zN7hp2fTyCp6Xy4D2rX a2Pql1hoCBR2+ywT+6eEYkLBr3KxQuoBNBKwinvMZ1e5qHMlRjLh+BKGi26zCCzFTbRtBBkkj ip+IK1fkIDMaKRNJ6Gpbb7hiPAOx/QCL1V9qTjbshMXQHyMGDjyIgoYhvP1wKxJOgbRCCzly6 13yOCr8k35dNBHgTh1ZTSd88EKcMyHAFa7SRbJpjh1l6mjfLL0TiuCuz6XWrrmEyR7koqjmOc eSMzHwTwoO02ym6Mg4KsiuHaIN0sYMUUFgoAtoGG+ne2XMtKUQ= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH] ALSA: rme9652: Use common error handling code in two functions 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: Mon, 14 Aug 2017 22:00:40 +0200 Add a jump target so that a bit of exception handling can be better reused in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- sound/pci/rme9652/hdsp.c | 13 ++++++------- sound/pci/rme9652/rme9652.c | 14 ++++++-------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index fe36d44d16c6..4750d14555bc 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -5381,17 +5381,16 @@ static int snd_hdsp_probe(struct pci_dev *pci, card->private_free = snd_hdsp_card_free; hdsp->dev = dev; hdsp->pci = pci; - - if ((err = snd_hdsp_create(card, hdsp)) < 0) { - snd_card_free(card); - return err; - } + err = snd_hdsp_create(card, hdsp); + if (err) + goto free_card; strcpy(card->shortname, "Hammerfall DSP"); sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, hdsp->port, hdsp->irq); - - if ((err = snd_card_register(card)) < 0) { + err = snd_card_register(card); + if (err) { +free_card: snd_card_free(card); return err; } diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 150d08898db8..b36ba7f9a7bf 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -2618,19 +2618,17 @@ static int snd_rme9652_probe(struct pci_dev *pci, card->private_free = snd_rme9652_card_free; rme9652->dev = dev; rme9652->pci = pci; - - if ((err = snd_rme9652_create(card, rme9652, precise_ptr[dev])) < 0) { - snd_card_free(card); - return err; - } + err = snd_rme9652_create(card, rme9652, precise_ptr[dev]); + if (err) + goto free_card; strcpy(card->shortname, rme9652->card_name); sprintf(card->longname, "%s at 0x%lx, irq %d", card->shortname, rme9652->port, rme9652->irq); - - - if ((err = snd_card_register(card)) < 0) { + err = snd_card_register(card); + if (err) { +free_card: snd_card_free(card); return err; }