From patchwork Wed Sep 6 13:16:29 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: 9940669 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 B68836035F for ; Wed, 6 Sep 2017 13:16:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACCC328BCD for ; Wed, 6 Sep 2017 13:16:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A18C828BDA; Wed, 6 Sep 2017 13:16:49 +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 E636528BCD for ; Wed, 6 Sep 2017 13:16:48 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0BF222673E7; Wed, 6 Sep 2017 15:16:43 +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 0017B2673E8; Wed, 6 Sep 2017 15:16:41 +0200 (CEST) Received: from mout.web.de (mout.web.de [212.227.15.4]) by alsa0.perex.cz (Postfix) with ESMTP id 639BF266B60 for ; Wed, 6 Sep 2017 15:16:40 +0200 (CEST) Received: from [192.168.1.2] ([77.182.162.119]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LpfJW-1dIyjY47uA-00fUkY; Wed, 06 Sep 2017 15:16:31 +0200 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Andrew Morton , Arvind Yadav , Dave Jiang , Jaroslav Kysela , Johan Hovold , Mauro Carvalho Chehab , Takashi Iwai References: <6743b977-4293-42d2-6c1b-cb83b687bd66@users.sourceforge.net> Message-ID: Date: Wed, 6 Sep 2017 15:16:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <6743b977-4293-42d2-6c1b-cb83b687bd66@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:zWvE7sSoOkfPXA4lsOXh762r9lPVEbGG8xl/4S3QsXkS66U+yDz vL/2hBGXKYYYR3C3mNTgu+X8uudnny8i8WAwnFzrHfHp++g70Hv5SVfvHFRlZFOIPBVGp3N YhR7GCVabAuNSPDKUIb8fHxhRKClJekU6IpKKpmzoVvi7P8Xbd2QuqzPMdn3oqwgHT03ys+ ADGEiUHJmTFhzya29MoAA== X-UI-Out-Filterresults: notjunk:1; V01:K0:B87fx2aKJzM=:IdzNfl4hvWWjdQCvbC1qlU gG8c45y8YQOOYz0NiXu75J5Mt86JptPCeGSWKayr83HJPom31xOq9OnnmnHgDJnAXzVaruMs/ ON/KQwpGdpB6Jv9YeN1gY1Q/7wipw6spp1jBg65BJh1kZzb/aS//B4LRnrG2Y40ZmIUCB9JUg GnXK8BCrtO9eDW+fWZDe4CahY+2jzyLafqmWq04vz/2iDQ4SVXvUBHZqZrzL8Xz9Xpiwhd+6M iz3kHmdW+LeIiveHh+sgn1aj5PDsP99adr+MGXu+rRKIVI3lgP0reIKxFd2pYIs7mNAfqPYax NpjbLoF3TquPHYiROyrigc7VHiHFOHtTzNwEGmFWegwWDn1fJlsPfjKnIEhYSUV+ogtxJ4XW4 dEAE6XiqynDytMTYxojmEez2bnut85GIckpNGjbb6WFKplYxplS/536xQdlus/RX8OEYoxnV+ 68tJG5vD6aG7UdO4Sekup0EQ2eqWc+/OJeRbIYR+k+mIPdO0mXrU8sCo6zWGACSTtRwB5BMvq plE0yaiDJaPpCBnplNXBtC2oIpc60VDVihfRC3hTPkkq4DHH/ndo+Tpv0reGYb4JTvJjVPdrk xgxTKc5osKBRv+731Bf/6JaBDeeade6ztrmB2E0/1W97l/OlLrYdtX5dMUX5oCOLLdVPzzeVw TzipKqnGb3kXhEJn4nOGId+BBjgQjwYBBZjuSK09JsPTXceTcuhnMPezMDtqLNVQKG7G5Da3r Nts9WWcx07DOf3qW2TWPxTJqqFlKq5kUnUQz/1+0wc+7WbHoI3+zD8vi+dmAUSvD5iwzN663Y 7iN1PfVXvoXAIAjHwFJsW7NEJvcCLSTzdllqbgZD5YKC4aXwNE= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 1/2] ALSA: us122l: Use common error handling code in us122l_create_card() 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 14:45:09 +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/usb/usx2y/us122l.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index b49d6e953d52..159da1f3924e 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c @@ -508,8 +508,7 @@ static bool us122l_create_card(struct snd_card *card) err = us122l_create_usbmidi(card); if (err < 0) { snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err); - us122l_stop(us122l); - return false; + goto stop; } err = usb_stream_hwdep_new(card); if (err < 0) { @@ -518,10 +517,13 @@ static bool us122l_create_card(struct snd_card *card) list_for_each(p, &us122l->midi_list) snd_usbmidi_disconnect(p); - us122l_stop(us122l); - return false; + goto stop; } return true; + +stop: + us122l_stop(us122l); + return false; } static void snd_us122l_free(struct snd_card *card)