From patchwork Tue Jan 24 10:24:08 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: 9535151 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 C15A860434 for ; Tue, 24 Jan 2017 12:57:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B299B20499 for ; Tue, 24 Jan 2017 12:57:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A66FA209CD; Tue, 24 Jan 2017 12:57:04 +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 DB63C20499 for ; Tue, 24 Jan 2017 12:57:03 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 259D92673BF; Tue, 24 Jan 2017 13:57:02 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7E240266CFB; Tue, 24 Jan 2017 13:54:43 +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 8F703266A12; Tue, 24 Jan 2017 11:24:14 +0100 (CET) Received: from mout.web.de (mout.web.de [217.72.192.78]) by alsa0.perex.cz (Postfix) with ESMTP id C5ED2266917 for ; Tue, 24 Jan 2017 11:24: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 0MEEeC-1clLQ93iEy-00FQQE; Tue, 24 Jan 2017 11:24:10 +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:24:08 +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:m7aRvpGugDXaq5CwvDNAqS0+6MtkTjbzHUw/CLQNxSI1Dgz4KTx teTaNHgp4olMVLtVPFizNGyCTVhUngaJq0YjKoF2ohU4T8h7nnH0EgB6eIBM2whB0pu84Mv 3MXnHUS8SmwXvywXWOCapBZI1EEXr/4KmuiCIFJsA5bGPIYeiCpESLHCfR8nzNG/cl+wTIx GV+f/40B9Y1to0hErdUuw== X-UI-Out-Filterresults: notjunk:1; V01:K0:FkG31xJB7ZQ=:KvoqosRm8OBeLAGv0kilYb lrRcmb2Kie9VOqXfx7fLG5mpP/+FgojCERbFblMJf3wLaVFsPeN/JtpMFI3wAPDoSp8YIylxD 7O51gqxATsmGjpiv+BIJhp2zq65dejAkOQYdpTu2unZParP2iypSdRj7JCoS3HNk2YEuVbk4I jqxjV6COcuCGk/RgBBRGQ7n3GMHpcaT/vlz2ty14F2JSd6M2PfzZnrZyUSV1X2/tpXzx3lRye p0bTydQBx7LToSGdRwydt8JSkZs0PLp+5x2qnO4W+uNRN9GSL1pL1TNG7TVEAWDN1OFkKYbm1 LU/Jy4YmekSSr2CwqFG9WR58x+mY0tSO8LXocg+gijR9Jn9J/XcHJ3YYDU696Aww6MNILIWPJ GoZQCo3HqFop1M1Sp2JAYTydjOv3/WEhzYKD6xjvgoRj8Ggn7YzN+8XTAqnNyGTajpqhOJY0o bC9wpBcBehjTMCoqGc9VGK5pwIFu5xGw1EzmWu7/pGni0c1jCD6WY/kFOSizii4cLw7pg+PCR 0h33L+QIv4pTCV2ErNpcM8hYM4PId4pjr/cVcioDWa2JrhAkIOJ4FhvVepsziXdYSZa9OdccI /pN7ASQADLh+ceaEvfkBdQussWqXszUDRyBdtWNX5jXKaCeGDJpo5Q9x0lpWqIpU+5kAnI6iG ckTvpIrf/P8b0HpgDfJfoftC0rvMAUhMuB2Na3EnZZmJmRtZ1lBA8VdY45TkwBhMLlTzMCl90 1yx2lVrK4aacXvDOfHl+UtQl+R0jfKEyWNTRMgiagdrSrieGcIn2vskDCoWmvdHBYfRFt5vA2 M2NRAgo Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 4/7] ALSA: seq: Delete unnecessary checks in snd_seq_ioctl_subscribe_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:06:38 +0100 Four checks were repeated by the snd_seq_ioctl_subscribe_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 ba26d622cb71..b9518e7cb623 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -1423,36 +1423,36 @@ static int snd_seq_ioctl_subscribe_port(struct snd_seq_client *client, { struct snd_seq_port_subscribe *subs = arg; int result = -EINVAL; - 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; /* connect them */ result = snd_seq_port_connect(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_SUBSCRIBED); - __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; }