From patchwork Fri Nov 17 21:18:04 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: 10064047 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 D7A496023A for ; Fri, 17 Nov 2017 21:18:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBADE2AE10 for ; Fri, 17 Nov 2017 21:18:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF66F2AE12; Fri, 17 Nov 2017 21:18:17 +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 1BEEE2AE10 for ; Fri, 17 Nov 2017 21:18:16 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 79264267867; Fri, 17 Nov 2017 22:18:15 +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 E79BF267868; Fri, 17 Nov 2017 22:18:13 +0100 (CET) Received: from mout.web.de (mout.web.de [212.227.15.3]) by alsa0.perex.cz (Postfix) with ESMTP id 61D21266B67 for ; Fri, 17 Nov 2017 22:18:12 +0100 (CET) Received: from [192.168.1.3] ([85.182.73.200]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MEEdU-1eQpaY29PM-00FRuw; Fri, 17 Nov 2017 22:18:06 +0100 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Bhumika Goyal , Jaroslav Kysela , Takashi Iwai , Takashi Sakamoto References: <67820e63-aed9-c775-8417-b0f531a9b305@users.sourceforge.net> Message-ID: Date: Fri, 17 Nov 2017 22:18:04 +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: <67820e63-aed9-c775-8417-b0f531a9b305@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:I5tXBi5eKKpqz452qY+/zqKjvhjmncyv7/cEUge/08mawOH7Wd/ dbmntq4AfoImVDw9yH1F4nQi9MRYfyyOyJ1m9Vk9lvtOmeFu8TZ3XxWGgF1JVqAfOB+RJ7I M2/ANlSxObFVkNQMa1TzcEBHy9L//KRVIQAT3Nqv5AbVqqRAh+6gqes6oSqt89bCet5hPEL /RbwkfHvZ3vmBlAWwU9Fg== X-UI-Out-Filterresults: notjunk:1; V01:K0:xlfGrFEPYCg=:bvEOW3tPPSphjhLeiMcipY bpxPisFcXADWY+1PbAweUJZLbvXQ4l02QX51b6NJ4MoZZVhiAvMWDO+E1wDF0L6+c8ReC+Lav ABcamlF72tufcbL0+xixXhTW/mXhdK1/sceT8fZLjQ+EwjWCkIrm1QOT19I13rdOTRBviQfFp D7LI8AvA1C+57PZ5j2G6XUqwVboTvS44rvx3ArPlHsy5XEfD0A2leRJUOqpTrOz/xowUjKgAh ZW71VPiumrOgrMPxeP+7vWoXOmMAcuH+ds6aigWZ+axT65wxh8uDqhhuSduYghD4kpx1mA5ey deOsshQokjw5j9dWX8xBy/Wn+KZX60r9pVluvXUpLxZNFi2kfWz7to3geQRpXbSuCMGS/77K2 T6N9LBS3+Ub1bX3XUe3jdu7xW/6dt1JFpExQjR4XA38DGKduupro3OOF5r6OqcQz5a28smJkz Oz2qBxlE1PC0ueiiHfW0JyyR8pUWfWDEy8g9Z+bedzZ9gjSTBy8yMrtgHO4M1apzj1FAKnNDS GdjYnOsUlWDz18wiCnqUBf1Bf5kaPxAElmj5XWt47CPeMrP/fAdaMVlJpdUACvnSYJHMia8oE 0yCouuKMcKPNwX3NCudDohrptmfr2QYRhcCeZykAVHl+zdz4e3jWUDdkTKZKP6ziP6S1g7HJu /KGjZsozry8D0iAwFzVfG0M9lS5fFJOSfZAc4dbhUiwE1FfJg2PYsi4jWZerPed8laN00FTNv NQrzsJX+x5jZTnrN9hCnm02kygMNHjUF/01M2SarE+Q1ktt3VwYOpHaN86ECCG7Lk24bLeRid GwI/yLKlV1PXdO/ifFBZjwZ1kYhQPS5tN+Wugsja1M0Tbjnths= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 2/3] ALSA: rme32: Use common error handling code in snd_rme32_probe() 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: Fri, 17 Nov 2017 21:14:48 +0100 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/pci/rme32.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index e58e9873c514..9e6e0fe3a285 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -1972,10 +1972,8 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) rme32->fullduplex_mode = 1; err = snd_rme32_create(rme32); - if (err < 0) { - snd_card_free(card); - return err; - } + if (err < 0) + goto free_card; strcpy(card->driver, "Digi32"); switch (rme32->pci->device) { @@ -1993,13 +1991,16 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) card->shortname, rme32->rev, rme32->port, rme32->irq); err = snd_card_register(card); - if (err < 0) { - snd_card_free(card); - return err; - } + if (err < 0) + goto free_card; + pci_set_drvdata(pci, card); dev++; return 0; + +free_card: + snd_card_free(card); + return err; } static void snd_rme32_remove(struct pci_dev *pci)