From patchwork Tue Jan 24 10:22:11 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: 9535111 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 762826042C for ; Tue, 24 Jan 2017 12:22:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 659DC26E55 for ; Tue, 24 Jan 2017 12:22:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5995827E3E; Tue, 24 Jan 2017 12:22:14 +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 938DE26E55 for ; Tue, 24 Jan 2017 12:22:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 059CC266CBD; Tue, 24 Jan 2017 13:22:12 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 69B18261A1A; Tue, 24 Jan 2017 13:19:53 +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 4AFA7266919; Tue, 24 Jan 2017 11:22:28 +0100 (CET) Received: from mout.web.de (mout.web.de [212.227.17.12]) by alsa0.perex.cz (Postfix) with ESMTP id C04012668C0 for ; Tue, 24 Jan 2017 11:22:26 +0100 (CET) Received: from [192.168.1.2] ([77.181.182.246]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MMEvB-1cbD222ACT-0085Md; Tue, 24 Jan 2017 11:22:15 +0100 To: alsa-devel@alsa-project.org, Clemens Ladisch , Jaroslav Kysela , Martin Koegler , Takashi Iwai , Takashi Sakamoto References: From: SF Markus Elfring Message-ID: <0f4cc184-1a9a-70ec-fba5-4c2224805e34@users.sourceforge.net> Date: Tue, 24 Jan 2017 11:22:11 +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:2VGK4h17wj0lcZyuDbhDe3CnL29oflS2u3ioJUQX6IO3lKKomPt vQNVgr0Qq2IlsJ87dzB1wOlkIfWk/8Yvyk7eZNIf8qJmVmVDOZLhoFfTfXXIFZWeHaGbBxZ Jc5WA4IqjKEXqxQVg0Dj5g3fqZ3lGSDNKDN57vDxxs9MgwHSn3RBkxxmkw55qPHrQrsGmKn dM6oGyaKwuAi9mbBdrmHw== X-UI-Out-Filterresults: notjunk:1; V01:K0:aIOuHxosxXU=:eMKeXUh548FmwPH+OpaH2J Yo2e9NTEPsMGexl04/tL6Kab6j4C9SKRANiY6Btp4hiMMw3lezNk/gvHE5loHO7ogsrTioiEJ sMPHFOiwBbYP6KOARpr+yO4K5bYlcRpsuebUWaWJm6JVsyfH14Z4IfMoNAC1E2qYQMWhjJSTJ kyHiGjLfi5RN/3Lb6Vk3LFebpNcB8666fTo6OpC/d423jiBP1ZVP81E2UVEROFpJPbHLgo+vv QSh+j0ldsboS/Jzdhi1ZH8dmSXWSoMFJ0LOQ1PmQAVraW0BW443takR6O1kBUpQeZ0KqhWeU7 4pLRY/RVCgIU6CDr7eJIhHD6aRdDuayzkFAvUvyj4FI+3FVxyBcTwJyNJzlWbUo5deLTo+13X 25WJF3YKWGMB/uRkjQTkIFUNMmSHwpekm9Eq94uFaSTjafnWdkLfouENJYM83hY0c+Jk+80cr Kn8UVxVfUMQLYW1ckKUMJVYZRdkUC54Yahfx0c01XxLeuBTagVHwbratbPShqm/cIhaRbkK2D rMuvdinN3ceHvA/wolgqiJ15+z49hgVmgSXcTfJIa9nKAL0RGUq/tMmQE3H3OonsBwoeOBX/r LyiXTkwHmbn+c6hlAzNe2b/13VU4C1HZ5M1H9TxQQP0FqW7FUz5j5XAUODcMOaZ/VG7Stzs2v GUD+X5ngFEmC2TyXBFGWNgrAUB1BeitUmVdTisuQsUtbuxMZBmRpinhwCCQCprsWJbm+dmqpa gMmvSH2pfgbsrC2VC/Zlaq3iuM3jCJ8P6wNJr8xP4FBfmTBhQpetoVigtZDHNASh8raWCNKSn Qpvgyfo Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 2/7] ALSA: seq: Delete unnecessary checks in snd_seq_ioctl_get_subscription() 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 08:54:36 +0100 Two checks were repeated by the snd_seq_ioctl_get_subscription() function despite of pointer determinations for the used variables at the beginning. * Adjust jump targets according to the Linux coding style convention. * Convert an assignment for the variable "result" to a direct initialisation. * 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 | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 594c341a193e..8e804ff784ed 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -1891,16 +1891,15 @@ static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client, void *arg) { struct snd_seq_port_subscribe *subs = arg; - int result; - struct snd_seq_client *sender = NULL; - struct snd_seq_client_port *sport = NULL; + int result = -EINVAL; + struct snd_seq_client *sender; + struct snd_seq_client_port *sport; struct snd_seq_subscribers *p; - result = -EINVAL; if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL) - goto __end; + goto exit; if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL) - goto __end; + goto unlock_client; p = snd_seq_port_get_subscription(&sport->c_src, &subs->dest); if (p) { result = 0; @@ -1908,12 +1907,10 @@ static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client, } else result = -ENOENT; - __end: - if (sport) - snd_seq_port_unlock(sport); - if (sender) - snd_seq_client_unlock(sender); - + snd_seq_port_unlock(sport); +unlock_client: + snd_seq_client_unlock(sender); +exit: return result; }