From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751030AbdAXK0M (ORCPT ); Tue, 24 Jan 2017 05:26:12 -0500 Received: from mout.web.de ([212.227.17.11]:55273 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750818AbdAXK0K (ORCPT ); Tue, 24 Jan 2017 05:26:10 -0500 Subject: [PATCH 5/7] ALSA: seq: Adjust 16 function calls together with a variable assignment 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:25:14 +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:j9rxumJPJFc0PS2gbigD3+3npTrnb9mDddGI5vmMvRcsxebl7Jc pyPAQJunxkhxUe6A7Ybc/Y6TAgzSXUqYL25uvjAXzrrWHlWCxpqnn3QXl5n2fOU1b/xVqUI kH/7anUws1lzRdc03XjBkSso69NvATJYSul+yHWBnPTzeWIqenYWIWxzA/z09I0a5DAsIWA YNjntnzgcNg3up7BEFICQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:Ct+5N6aMf+o=:LIFU13Mk3bsYLc4LMqcrqt NrqNH89YKbl9b6QWlZ3qggB2YDDvNNk69vwk+Ys3JAE62rQZPKljItMYKScukn7wPkhL+Btst UjObdb2QKiPCs/QFaQryL++7iXDnQ8F6SeOMQwNWhctFvAZ+uzKrp8BxXsd+T4YB9mIvkSkT3 Md6UHI+Bx046LHv9JPCFvEXVsGiNKCnP0VC1yy1l2sSegLLoXmlFOO5NXZTv6kZOA+KqAbGmc hitVACUsxJ46DkwKteuPYvcqsmlZ9UkrsQgjvZHuGeVvQr4mlpREuR6/JKOF8HAMaVamHQXlG B/wafOmbZFUnLzliMjkyOWG9m2lUb3LEy5nV4mmY30B4jL9dZurxiFYq4Nng7qu+G7Wzbooed 7rYcFHHt8ovPPRBebRxz4nVn4XdW73b32VM/IBJS/5zn/kEkAA2p4hsp5IojyXONNNqS8qZwJ EqCWo8CWN/xkbXtfTjvZuPMDaEaefjqCPaFh0VU2Mq9OzNJfYRIcNDp9KKOASavL9++SHkp2g bSuKuTlkhGU4ejcIoIAqblbAfbv4K+Z3Fiq8tahLXTpijTv/n6m9ZIQ5lLb45bCpBEEDQ55zc DOKGkWZFZY1DdrsIzDBjWzD8ZeFZMdUDGiEujROhaB07WXB7vdBj6MyT78PJP75TiT6cUgXrr Iq+86lq5VS8ZcQ7CX5sc7TylJXvUos1jGiaxWUdZHe29WYYZUw53yaq+RCAIQptuLXIMQF/bo lIN0bQlpfZ///fdC2uY1I56M6RJkDs/w0SREKMw6FAzvrtc1jUihRF2sTARuhV1UIh9OqcC6a bUcghUl 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:44:22 +0100 The script "checkpatch.pl" pointed information out like the following. ERROR: do not use assignment in if condition Thus fix the affected source code places. Signed-off-by: Markus Elfring --- sound/core/seq/seq_clientmgr.c | 52 ++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index b9518e7cb623..519968841ccc 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -400,7 +400,11 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, if (snd_BUG_ON(!client)) return -ENXIO; - if (!client->accept_input || (fifo = client->data.user.fifo) == NULL) + if (!client->accept_input) + return -ENXIO; + + fifo = client->data.user.fifo; + if (!fifo) return -ENXIO; if (atomic_read(&fifo->overflow) > 0) { @@ -419,9 +423,9 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, int nonblock; nonblock = (file->f_flags & O_NONBLOCK) || result > 0; - if ((err = snd_seq_fifo_cell_out(fifo, &cell, nonblock)) < 0) { + err = snd_seq_fifo_cell_out(fifo, &cell, nonblock); + if (err < 0) break; - } if (snd_seq_ev_is_variable(&cell->event)) { struct snd_seq_event tmpev; tmpev = cell->event; @@ -948,7 +952,8 @@ static int snd_seq_client_enqueue_event(struct snd_seq_client *client, return err; /* we got a cell. enqueue it. */ - if ((err = snd_seq_enqueue_event(cell, atomic, hop)) < 0) { + err = snd_seq_enqueue_event(cell, atomic, hop); + if (err < 0) { snd_seq_cell_free(cell); return err; } @@ -1273,7 +1278,8 @@ static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg) return -EINVAL; } if (client->type == KERNEL_CLIENT) { - if ((callback = info->kernel) != NULL) { + callback = info->kernel; + if (callback) { if (callback->owner) port->owner = callback->owner; port->private_data = callback->private_data; @@ -1426,13 +1432,17 @@ static int snd_seq_ioctl_subscribe_port(struct snd_seq_client *client, struct snd_seq_client *receiver, *sender; struct snd_seq_client_port *sport, *dport; - if ((receiver = snd_seq_client_use_ptr(subs->dest.client)) == NULL) + receiver = snd_seq_client_use_ptr(subs->dest.client); + if (!receiver) goto exit; - if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL) + sender = snd_seq_client_use_ptr(subs->sender.client); + if (!sender) goto unlock_receiver; - if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL) + sport = snd_seq_port_use_ptr(sender, subs->sender.port); + if (!sport) goto unlock_sender; - if ((dport = snd_seq_port_use_ptr(receiver, subs->dest.port)) == NULL) + dport = snd_seq_port_use_ptr(receiver, subs->dest.port); + if (!dport) goto unlock_sport; result = check_subscription_permission(client, sport, dport, subs); @@ -1468,13 +1478,17 @@ static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client, struct snd_seq_client *receiver, *sender; struct snd_seq_client_port *sport, *dport; - if ((receiver = snd_seq_client_use_ptr(subs->dest.client)) == NULL) + receiver = snd_seq_client_use_ptr(subs->dest.client); + if (!receiver) goto exit; - if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL) + sender = snd_seq_client_use_ptr(subs->sender.client); + if (!sender) goto unlock_receiver; - if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL) + sport = snd_seq_port_use_ptr(sender, subs->sender.port); + if (!sport) goto unlock_sender; - if ((dport = snd_seq_port_use_ptr(receiver, subs->dest.port)) == NULL) + dport = snd_seq_port_use_ptr(receiver, subs->dest.port); + if (!dport) goto unlock_sport; result = check_subscription_permission(client, sport, dport, subs); @@ -1896,9 +1910,11 @@ static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client, struct snd_seq_client_port *sport; struct snd_seq_subscribers *p; - if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL) + sender = snd_seq_client_use_ptr(subs->sender.client); + if (!sender) goto exit; - if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL) + sport = snd_seq_port_use_ptr(sender, subs->sender.port); + if (!sport) goto unlock_client; p = snd_seq_port_get_subscription(&sport->c_src, &subs->dest); if (p) { @@ -1928,9 +1944,11 @@ static int snd_seq_ioctl_query_subs(struct snd_seq_client *client, void *arg) struct list_head *p; int i; - if ((cptr = snd_seq_client_use_ptr(subs->root.client)) == NULL) + cptr = snd_seq_client_use_ptr(subs->root.client); + if (!cptr) goto exit; - if ((port = snd_seq_port_use_ptr(cptr, subs->root.port)) == NULL) + port = snd_seq_port_use_ptr(cptr, subs->root.port); + if (!port) goto unlock_client; switch (subs->type) { -- 2.11.0