From patchwork Tue Jan 24 10:23:06 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: 9535131 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 0B20F6042D for ; Tue, 24 Jan 2017 12:39:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F237A27F54 for ; Tue, 24 Jan 2017 12:39:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E71C327F89; Tue, 24 Jan 2017 12:39:39 +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=unavailable 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 7F98027F54 for ; Tue, 24 Jan 2017 12:39:38 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id E2867266CAF; Tue, 24 Jan 2017 13:39:36 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7C82F266CF3; Tue, 24 Jan 2017 13:37:18 +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 65C27266919; Tue, 24 Jan 2017 11:23:12 +0100 (CET) Received: from mout.web.de (mout.web.de [217.72.192.78]) by alsa0.perex.cz (Postfix) with ESMTP id A3F052668C0 for ; Tue, 24 Jan 2017 11:23:10 +0100 (CET) Received: from [192.168.1.2] ([77.181.182.246]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MHY1o-1cX4BE1hYi-003Jr3; Tue, 24 Jan 2017 11:23:08 +0100 To: alsa-devel@alsa-project.org, Clemens Ladisch , Jaroslav Kysela , Martin Koegler , Takashi Iwai , Takashi Sakamoto References: From: SF Markus Elfring Message-ID: Date: Tue, 24 Jan 2017 11:23:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:4LD8dP8gpm1MD6YFIhxt9/3UXn82EfwJQK9Ff35iZtTpwwOVvDL CiGJA+x3ILDeH0E639lL5vV3CxJIcFCZId6CaqTL9oLy1Bph1aT2p1RioF9DgiCcOFjDyvf kfi63JbbYISnj+vqONsyPdXreS94F7qnQOgJrKl8zdDhhjLtypvMD9J/QPhzyo+bAvWhJ4G jPWog/1kfNc454UDe87Nw== X-UI-Out-Filterresults: notjunk:1; V01:K0:eAOto37KqiI=:gIFfFr2ckM8tw+JsoHFLH/ +cts4JHZ15LFw2kX78Yu6u2z8ENgFS4mOSx25com8ScuQhtHm5HTWJZorheH5EmaWjScK595j sFXbSWYyC8towsZCaqs5XmUIn/4DlFMD0lYDt7pcollh/yM546BTB87NPCNrw4ZeNIaw2S2h4 QISsICsQ8ZtvFK/ALkEhEco+r1n/1naVDKeXjiUDOuH+Bru5VTWgbRga+tGY4aP2crUajzMVs f4c/mgS20dOr0bWF1czDaL/gvqsktn3JkMYUBVxfVT/A9F8RhP1+Y6EU1gCPrxp0FP2FBXJE+ Y4g0elCBKCG9poHtA8Qq9/mdOE9TezWiviHteNbJfJui2NR3yoGXkojmD4N6XTwD5dM77J10H GsawpkOQusuojvoR5SR/m/37a39CpPGrZJXpzj6zC4sFewpPg4pmeIw/AvrEOEZfdm3zswD5D zLVIU3zlOMnfTetpMUp/T5E6ICh0ugJPzqbr8IxeHOBR8AI1x8v0eTekqZIHlF/qmAxOKSOBL O17SD0KntoQRGiCnRpm6wEc+k2iY74OPw5JQLjN+4l2a1PRw+VqrdDAJK3X24EyjXBmkLTekR 1l2kz7+bNamCnka0Cn9DRoD3a7lfBVl6fem+YP1TWBcpcEzypl7pz2XN0iJLA5p3+VnMurMC5 SS5Uc9nGfbGiIuZL/nsGUlAI8fkEBjx7u1VulccSkifVxQNIqggnHJtWFfe0dyHL5/I3jCA36 QOLET4M4dWWkO2CnskkQtVwOz9NpRKbPylrXLPeD/sI7Rh3vH8v2V87afjOkcg/ULmAHQ0cNM WPRA+vY Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 3/7] ALSA: seq: Delete unnecessary checks in snd_seq_ioctl_unsubscribe_port() 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, 24 Jan 2017 09:01:17 +0100 Four checks were repeated by the snd_seq_ioctl_unsubscribe_port() function despite of pointer determinations for the used variables at the beginning. * Adjust jump targets according to the Linux coding style convention. * Delete extra variable initialisations and the repeated checks which became unnecessary with this refactoring. Signed-off-by: Markus Elfring --- sound/core/seq/seq_clientmgr.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 8e804ff784ed..ba26d622cb71 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -1465,35 +1465,35 @@ static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client, { struct snd_seq_port_subscribe *subs = arg; int result = -ENXIO; - struct snd_seq_client *receiver = NULL, *sender = NULL; - struct snd_seq_client_port *sport = NULL, *dport = NULL; + struct snd_seq_client *receiver, *sender; + struct snd_seq_client_port *sport, *dport; if ((receiver = snd_seq_client_use_ptr(subs->dest.client)) == NULL) - goto __end; + goto exit; if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL) - goto __end; + goto unlock_receiver; if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL) - goto __end; + goto unlock_sender; if ((dport = snd_seq_port_use_ptr(receiver, subs->dest.port)) == NULL) - goto __end; + goto unlock_sport; result = check_subscription_permission(client, sport, dport, subs); if (result < 0) - goto __end; + goto unlock_dport; result = snd_seq_port_disconnect(client, sender, sport, receiver, dport, subs); if (! result) /* broadcast announce */ snd_seq_client_notify_subscription(SNDRV_SEQ_ADDRESS_SUBSCRIBERS, 0, subs, SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED); - __end: - if (sport) - snd_seq_port_unlock(sport); - if (dport) - snd_seq_port_unlock(dport); - if (sender) - snd_seq_client_unlock(sender); - if (receiver) - snd_seq_client_unlock(receiver); +unlock_dport: + snd_seq_port_unlock(dport); +unlock_sport: + snd_seq_port_unlock(sport); +unlock_sender: + snd_seq_client_unlock(sender); +unlock_receiver: + snd_seq_client_unlock(receiver); +exit: return result; }