From patchwork Fri Nov 17 21:16:02 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: 10064041 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 DFA64601D3 for ; Fri, 17 Nov 2017 21:16:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D31A32AE0E for ; Fri, 17 Nov 2017 21:16:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C69852AE10; Fri, 17 Nov 2017 21:16:44 +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 EEB582AE0E for ; Fri, 17 Nov 2017 21:16:43 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id CAA18267860; Fri, 17 Nov 2017 22:16:42 +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 69957267861; Fri, 17 Nov 2017 22:16:42 +0100 (CET) Received: from mout.web.de (mout.web.de [212.227.15.4]) by alsa0.perex.cz (Postfix) with ESMTP id A52D9266B67 for ; Fri, 17 Nov 2017 22:16:40 +0100 (CET) Received: from [192.168.1.3] ([85.182.73.200]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LmcRH-1eoJfD3EMF-00aBLX; Fri, 17 Nov 2017 22:16:04 +0100 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Bhumika Goyal , Jaroslav Kysela , Takashi Iwai , Takashi Sakamoto References: <67820e63-aed9-c775-8417-b0f531a9b305@users.sourceforge.net> Message-ID: <85f2946e-1155-2db2-6bd8-04eeea067178@users.sourceforge.net> Date: Fri, 17 Nov 2017 22:16:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <67820e63-aed9-c775-8417-b0f531a9b305@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:J9SpOA+WfAD58k5FMbeMH7x5XDEhuU+3mYRmeUaNP9/KDeZvNsX isFWzR2jwfKmqLb12vR5XYLf3p8+kUGovGL5dZcRVMRhUt2VmAIyJyKye/oA+aGQJGtUbEh vybqdgn9011csfoDC9yZM74C/LaiUMV709hypBQZ5kONM8ztGPMUpNriQ49VZ2CkZ1iZRWu vYH7dOC7A2N/dED9scXBw== X-UI-Out-Filterresults: notjunk:1; V01:K0:wWjvoD2gDfQ=:SwXoM2cbGkCktqM55KJPuL +/TRO866wdwVIWydEP/n9LbD77tEnnKS874bnDZfKJ3NTeXPUrFSOYzdYEAEUEgrxyjul8gSW Ti7F68JTeIZEP2TyN7pJjlk+pWrzUOgkcddPsqivHvkNZbrSoQpR7m1uyERpRVDpc5kY8L5PT hY8T89euzWLi8hWKoyhD6gJfRZK6bZjRrfrr/ZNeCI2U12/TO6SwLWbNcrszfgNi8d+tdrT0k uFNRQxq8ro1EQFOPeVG7fpxjzOmKosxrkRue6Cqdbr2rdKHlboNT7dx8Dk0OowI1Sr1+ArH4A z9MjGEasfi1JCtW/s/8G14eGseW4iqzH8PukVRrPcnaqS9C1v9+qLgI0DtFKOZHNR6NZtVWS4 JN14RnaOM3x+sDIUe03PfcU5dmwzg4WS+SDAjppSAcTMZAbUSqJ/3bpweYxEIEVm8DnZ68Nik Fm+EVQmKjlhoEo62PTUTm0GP594IYSbKWaa6jnJ/aHApQrb+MMVtbPaFi8MXA9I///+CmXF7X sAvaTLgfFwIm0+qvo/x1vnuVG1B/6AdHtBhBsBCj+3LhW4bU1HkDSIr4OxAoQ9uiGpRC30ATi fXQXyUd7DazV6UJ9p6DOM/D+KbhANsJtL4Zrzv/aDFvL+AiBMsldh5KfAN+qKqy/eaVe1p5yL CrtmXErXBxLZsbmGMJa7OLk+qt0O5uIMBAzU7ibyBJLHfG9hG9Dsqp+b+alWFm2FmmLx9wTcW 7h4xlwb3fgHB2cmRNO+KpjePLbRV7SdpHiBGGwD16faLPd+Aq5db66uH6HrNbQa7b+Mq8V8So 7RjT4z+BmMeZqJHGDCSE9MNq2cntRUduiiFIWjXAw4Vvu5x5fw= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 1/3] ALSA: rme32: Adjust 15 function calls together with a variable assignment 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: Fri, 17 Nov 2017 21:00:37 +0100 The script "checkpatch.pl" pointed information out like the following. ERROR: do not use assignment in if condition Thus fix affected source code places. Signed-off-by: Markus Elfring --- sound/pci/rme32.c | 65 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index f0906ba416d4..e58e9873c514 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -691,11 +691,16 @@ snd_rme32_playback_hw_params(struct snd_pcm_substream *substream, spin_unlock_irq(&rme32->lock); return -EIO; } - } else if ((err = snd_rme32_playback_setrate(rme32, params_rate(params))) < 0) { - spin_unlock_irq(&rme32->lock); - return err; + } else { + err = snd_rme32_playback_setrate(rme32, params_rate(params)); + if (err < 0) { + spin_unlock_irq(&rme32->lock); + return err; + } } - if ((err = snd_rme32_setformat(rme32, params_format(params))) < 0) { + + err = snd_rme32_setformat(rme32, params_format(params)); + if (err < 0) { spin_unlock_irq(&rme32->lock); return err; } @@ -743,15 +748,18 @@ snd_rme32_capture_hw_params(struct snd_pcm_substream *substream, rme32->wcreg |= RME32_WCR_AUTOSYNC; writel(rme32->wcreg, rme32->iobase + RME32_IO_CONTROL_REGISTER); - if ((err = snd_rme32_setformat(rme32, params_format(params))) < 0) { + err = snd_rme32_setformat(rme32, params_format(params)); + if (err < 0) { spin_unlock_irq(&rme32->lock); return err; } - if ((err = snd_rme32_playback_setrate(rme32, params_rate(params))) < 0) { + err = snd_rme32_playback_setrate(rme32, params_rate(params)); + if (err < 0) { spin_unlock_irq(&rme32->lock); return err; } - if ((rate = snd_rme32_capture_getrate(rme32, &isadat)) > 0) { + rate = snd_rme32_capture_getrate(rme32, &isadat); + if (rate > 0) { if ((int)params_rate(params) != rate) { spin_unlock_irq(&rme32->lock); return -EIO; @@ -923,7 +931,9 @@ static int snd_rme32_capture_spdif_open(struct snd_pcm_substream *substream) runtime->hw.rates |= SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000; runtime->hw.rate_max = 96000; } - if ((rate = snd_rme32_capture_getrate(rme32, &isadat)) > 0) { + + rate = snd_rme32_capture_getrate(rme32, &isadat); + if (rate > 0) { if (isadat) { return -EIO; } @@ -983,7 +993,9 @@ snd_rme32_capture_adat_open(struct snd_pcm_substream *substream) runtime->hw = snd_rme32_adat_fd_info; else runtime->hw = snd_rme32_adat_info; - if ((rate = snd_rme32_capture_getrate(rme32, &isadat)) > 0) { + + rate = snd_rme32_capture_getrate(rme32, &isadat); + if (rate > 0) { if (!isadat) { return -EIO; } @@ -1357,10 +1369,12 @@ static int snd_rme32_create(struct rme32 *rme32) rme32->irq = -1; spin_lock_init(&rme32->lock); - if ((err = pci_enable_device(pci)) < 0) + err = pci_enable_device(pci); + if (err < 0) return err; - if ((err = pci_request_regions(pci, "RME32")) < 0) + err = pci_request_regions(pci, "RME32"); + if (err < 0) return err; rme32->port = pci_resource_start(rme32->pci, 0); @@ -1383,9 +1397,11 @@ static int snd_rme32_create(struct rme32 *rme32) pci_read_config_byte(pci, 8, &rme32->rev); /* set up ALSA pcm device for S/PDIF */ - if ((err = snd_pcm_new(rme32->card, "Digi32 IEC958", 0, 1, 1, &rme32->spdif_pcm)) < 0) { + err = snd_pcm_new(rme32->card, "Digi32 IEC958", + 0, 1, 1, &rme32->spdif_pcm); + if (err < 0) return err; - } + rme32->spdif_pcm->private_data = rme32; rme32->spdif_pcm->private_free = snd_rme32_free_spdif_pcm; strcpy(rme32->spdif_pcm->name, "Digi32 IEC958"); @@ -1413,11 +1429,11 @@ static int snd_rme32_create(struct rme32 *rme32) rme32->adat_pcm = NULL; } else { - if ((err = snd_pcm_new(rme32->card, "Digi32 ADAT", 1, - 1, 1, &rme32->adat_pcm)) < 0) - { + err = snd_pcm_new(rme32->card, "Digi32 ADAT", + 1, 1, 1, &rme32->adat_pcm); + if (err < 0) return err; - } + rme32->adat_pcm->private_data = rme32; rme32->adat_pcm->private_free = snd_rme32_free_adat_pcm; strcpy(rme32->adat_pcm->name, "Digi32 ADAT"); @@ -1460,9 +1476,9 @@ static int snd_rme32_create(struct rme32 *rme32) /* init switch interface */ - if ((err = snd_rme32_create_switches(rme32->card, rme32)) < 0) { + err = snd_rme32_create_switches(rme32->card, rme32); + if (err < 0) return err; - } /* init proc interface */ snd_rme32_proc_init(rme32); @@ -1908,7 +1924,9 @@ static int snd_rme32_create_switches(struct snd_card *card, struct rme32 * rme32 struct snd_kcontrol *kctl; for (idx = 0; idx < (int)ARRAY_SIZE(snd_rme32_controls); idx++) { - if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_rme32_controls[idx], rme32))) < 0) + kctl = snd_ctl_new1(&snd_rme32_controls[idx], rme32); + err = snd_ctl_add(card, kctl); + if (err < 0) return err; if (idx == 1) /* IEC958 (S/PDIF) Stream */ rme32->spdif_ctl = kctl; @@ -1952,7 +1970,9 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) rme32->pci = pci; if (fullduplex[dev]) rme32->fullduplex_mode = 1; - if ((err = snd_rme32_create(rme32)) < 0) { + + err = snd_rme32_create(rme32); + if (err < 0) { snd_card_free(card); return err; } @@ -1972,7 +1992,8 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) sprintf(card->longname, "%s (Rev. %d) at 0x%lx, irq %d", card->shortname, rme32->rev, rme32->port, rme32->irq); - if ((err = snd_card_register(card)) < 0) { + err = snd_card_register(card); + if (err < 0) { snd_card_free(card); return err; }