From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751052AbdAXKYI (ORCPT ); Tue, 24 Jan 2017 05:24:08 -0500 Received: from mout.web.de ([217.72.192.78]:63712 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750786AbdAXKYG (ORCPT ); Tue, 24 Jan 2017 05:24:06 -0500 Subject: [PATCH 3/7] ALSA: seq: Delete unnecessary checks in snd_seq_ioctl_unsubscribe_port() To: alsa-devel@alsa-project.org, Clemens Ladisch , Jaroslav Kysela , Martin Koegler , Takashi Iwai , Takashi Sakamoto References: Cc: LKML , kernel-janitors@vger.kernel.org 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: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.11.0 From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Tue, 24 Jan 2017 10:23:06 +0000 Subject: [PATCH 3/7] ALSA: seq: Delete unnecessary checks in snd_seq_ioctl_unsubscribe_port() Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: alsa-devel@alsa-project.org, Clemens Ladisch , Jaroslav Kysela , Martin Koegler , Takashi Iwai , Takashi Sakamoto Cc: LKML , kernel-janitors@vger.kernel.org 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; } -- 2.11.0