From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750865AbdAXKWD (ORCPT ); Tue, 24 Jan 2017 05:22:03 -0500 Received: from mout.web.de ([212.227.15.14]:50789 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbdAXKWB (ORCPT ); Tue, 24 Jan 2017 05:22:01 -0500 Subject: [PATCH 1/7] ALSA: seq: Delete unnecessary checks in snd_seq_ioctl_query_subs() 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: <39bc00c0-ffe7-851c-f329-e7d499f561be@users.sourceforge.net> Date: Tue, 24 Jan 2017 11:21:13 +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:teZdptwjfY7LG5ewjz3Mzj5me74ORf1cn0k98nXBh0X3vOkfXQT EiY86SWO99Xh304qH/3w5FY1K6lstMKnYI574JwUlSPs1UU2enR373Xtiuwum/1Dxg9cBBR 8R6ogPAmmPm8O45hHZb5ACQbIzM4bVmKtwUvJhSbEHq4fdd/Z2VMTqhMAZwsTPdircooZ1F LWgGovE08sNmNzBJD+xGA== X-UI-Out-Filterresults: notjunk:1;V01:K0:OfUBypF91to=:xNOaVCAKm4f5FMcHr2LNI+ /JEE0n6QN1dwSXbsBlzliUM+RXMRW3F7PRgKDo+n/5Fe5iNl6roPr5uzRvE1CFPJAwoDyUxh9 UvX0BmQmgHmQSvovexfde+txWlnh8QclTQe7sJkiAyw0kP92pkHiO3W9xGqvX4tMpQUv1FJ+2 Zc8L/U/QBIhAiOeTJG3N8vdjA+ZyCv7yynw6hHh+rGLCw0yNFNQ+zSAch5XffQh7BDTU9A/jj NoxNOaarm0lWFNgvEM9GCf1eFDW+7TkcbcY6pRbpFyyLXtKeSoMzUGezUNqHqY5u4GCcxU6jp 6+GomkhGhgS3iivTo33Z5yGWD+ZjZsLy2AxAnh2/PaAdtIp/EAjZcpnvH9mufehhbw1YEgHJ1 r9d26f2lHn/uvr3k0jEbReNL+IVpK6oy+NOOkLZfuVmmTvutRCTnAaY3QZVSRJGycMrVHieHE QUK5ZNTv2LNlId91lAMChPLIRCxAsnuY9Txm4aAuEWux5nSlQuP69tF5u+DXLhFEKHUulYMYo MDSRisM6FgMXsfmdN549KyEyed/axrVrSWw+n94exY6RAYzR4oppsJumZDRbESm1DV5z0bv0L +OZdQIlEsNfV0GANjPjCl8jenGGFe7GV0ZiLnJkV60Pt+zjQ19ssJVP1WJRmOIIMCtIFYj9Sw 0zC2Pqsf7gnep3mZhtVrat6BHz3LKB/198LkymiAW9NWOlDuFRSQBykEcyi4NwSwG54Qh7IM/ 9QFm0UQsWEB1ZANeKt3qEccy6racETGcXWnFuaAuv3aLSJ77QpWAFp6NSzRZ+KEuS/YghNcxk SC4oy/z 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 08:00:34 +0100 Two checks were repeated by the snd_seq_ioctl_query_subs() 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 | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 4c935202ce23..594c341a193e 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -1925,16 +1925,16 @@ static int snd_seq_ioctl_query_subs(struct snd_seq_client *client, void *arg) { struct snd_seq_query_subs *subs = arg; int result = -ENXIO; - struct snd_seq_client *cptr = NULL; - struct snd_seq_client_port *port = NULL; + struct snd_seq_client *cptr; + struct snd_seq_client_port *port; struct snd_seq_port_subs_info *group; struct list_head *p; int i; if ((cptr = snd_seq_client_use_ptr(subs->root.client)) == NULL) - goto __end; + goto exit; if ((port = snd_seq_port_use_ptr(cptr, subs->root.port)) == NULL) - goto __end; + goto unlock_client; switch (subs->type) { case SNDRV_SEQ_QUERY_SUBS_READ: @@ -1944,7 +1944,7 @@ static int snd_seq_ioctl_query_subs(struct snd_seq_client *client, void *arg) group = &port->c_dest; break; default: - goto __end; + goto unlock_port; } down_read(&group->list_mutex); @@ -1970,13 +1970,11 @@ static int snd_seq_ioctl_query_subs(struct snd_seq_client *client, void *arg) } } up_read(&group->list_mutex); - - __end: - if (port) - snd_seq_port_unlock(port); - if (cptr) - snd_seq_client_unlock(cptr); - +unlock_port: + snd_seq_port_unlock(port); +unlock_client: + snd_seq_client_unlock(cptr); +exit: return result; } -- 2.11.0