From patchwork Wed Nov 15 12:46:30 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: 10059325 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 0087060231 for ; Wed, 15 Nov 2017 12:46:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5C19204BD for ; Wed, 15 Nov 2017 12:46:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9E5129F77; Wed, 15 Nov 2017 12:46: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 A55A729C6E for ; Wed, 15 Nov 2017 12:46:43 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7FCE1267019; Wed, 15 Nov 2017 13:46: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 297B626701D; Wed, 15 Nov 2017 13:46:41 +0100 (CET) Received: from mout.web.de (mout.web.de [217.72.192.78]) by alsa0.perex.cz (Postfix) with ESMTP id 7FB3F266D11 for ; Wed, 15 Nov 2017 13:46:39 +0100 (CET) Received: from [192.168.1.3] ([77.182.217.107]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LecNe-1eygh40Nck-00qUyc; Wed, 15 Nov 2017 13:46:32 +0100 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Andy Shevchenko , Bhumika Goyal , Jaroslav Kysela , Takashi Iwai References: <86b94d9c-77fb-fed5-b55c-a0565f619dc7@users.sourceforge.net> Message-ID: <5db5ffad-1bb7-d713-6bce-c4ca8ab8cbc6@users.sourceforge.net> Date: Wed, 15 Nov 2017 13:46:30 +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: <86b94d9c-77fb-fed5-b55c-a0565f619dc7@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:ihPfqo8YSYkyA/wr5mVyQGLnG1Qzk8VDO2gnIqixWfdZT0SwdnU Wq0V+fMA/99XtBed1tzqxsJPvvJPG2uT3c8mp6Dk7ETXIUwTGKEAHjZNO+Xz7zMl3Pbd8eQ NcS5cmtIEtzPjVoMPxWhM/9c+t/7X+eDwGjPMItrOFIkIpdpECMWQygCYfiAEDhY1KKrJC3 S+v3LwUA0UHdTLTOuNLdA== X-UI-Out-Filterresults: notjunk:1; V01:K0:YtjVmwIRTkU=:drAzdofyKbJ38eqWb8VDlM 8SUqiWO7+jVUuuqCEqYIPeVJvTXjzB+305q/hzbOPPFPAV9BYY1C2LUFtU4y/CDjhKUMrmA5i bWCf7gvc7Ib/tR2E9jVzhCHoNYqPxBIgob7O+MwHhAGpVnPudGuhXedYnYcntiFTr+fiszDGd Hx/x4sSGlQyItUyaNKzHnb364LxomfsNUvuQq36ZjqffFVwtfLdBfOI8LYJJ8AYy8hcd6KhWB UWNQu1TTNsePRjCqAZzEl68WxoEL+SK0vz6xH/GcvBcYDMjL3JRy8jG6/jcPvFPXV5Jj+0Y1F AU/+0EQ5OesDsaJ9qYruoy1/CMjPkDevu3EoFXiGA9ZJX+4xjKYN+bIQmuqqt1HNQ8buHahzI 8TJb3zJ3srax4wJ3eeaFqd5i6IVeTT8pRpqo5mIabNIMMMiID8cee/Twx/08IdfibmOQQaARc Gnul8+4hb+hTgIyC13fZzMV65BSBnMgZSjJaeSzPinNfGXLfIUneC9giQ4VeYV+gnhVtIWrzN 0LZ43ECPW1cgUaD+xhthR4YSCT/QekC4dNEGF+EKr68fdROssIWWjrSsNZMtLGyScnDMiyc/k rqQgn7k4E+KVgyltNe9cVWZsdmD8AXrTV1nYrwfPWMiyWt2vrsPIAc1KV3ZWgKfwVK8WtIePX 7DQx6bA8n9hcJQ40kOauJ8uAAWSNe3BgBPSPgK3K6IXR4cvUtBREL2+6uYdnx3WjmRTS3dzo5 Gf8WiIaaba5psgFkGhKeRZuIR/oxMEKrgV4lCiQ1qXxvqkOwKZGW2i/PL4m9Cy/vLMhisSGIy D6OIZutVGTzhGP6mEdP5ovudZ6o3qw0hEvFPSRoGxIAaZmSnKk= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 1/3] ALSA: fm801: Adjust 17 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: Wed, 15 Nov 2017 13:20:49 +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/pci/fm801.c | 75 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 73a67bc3586b..3648af4581a0 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -655,9 +655,10 @@ static int snd_fm801_playback_open(struct snd_pcm_substream *substream) SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels); } - if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) - return err; - return 0; + + err = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS); + return (err < 0) ? err : 0; } static int snd_fm801_capture_open(struct snd_pcm_substream *substream) @@ -670,9 +671,9 @@ static int snd_fm801_capture_open(struct snd_pcm_substream *substream) runtime->hw = snd_fm801_capture; snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); - if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) - return err; - return 0; + err = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS); + return (err < 0) ? err : 0; } static int snd_fm801_playback_close(struct snd_pcm_substream *substream) @@ -717,9 +718,9 @@ static int snd_fm801_pcm(struct fm801 *chip, int device) { struct pci_dev *pdev = to_pci_dev(chip->dev); struct snd_pcm *pcm; - int err; + int err = snd_pcm_new(chip->card, "FM801", device, 1, 1, &pcm); - if ((err = snd_pcm_new(chip->card, "FM801", device, 1, 1, &pcm)) < 0) + if (err < 0) return err; snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_fm801_playback_ops); @@ -986,10 +987,10 @@ static int snd_fm801_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct fm801 *chip = snd_kcontrol_chip(kcontrol); - unsigned short val; + unsigned short val = ucontrol->value.enumerated.item[0]; - if ((val = ucontrol->value.enumerated.item[0]) > 4) - return -EINVAL; + if (val > 4) + return -EINVAL; return snd_fm801_update_bits(chip, FM801_REC_SRC, 7, val); } @@ -1053,19 +1054,22 @@ static int snd_fm801_mixer(struct fm801 *chip) .read = snd_fm801_codec_read, }; - if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus)) < 0) + err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus); + if (err < 0) return err; chip->ac97_bus->private_free = snd_fm801_mixer_free_ac97_bus; memset(&ac97, 0, sizeof(ac97)); ac97.private_data = chip; ac97.private_free = snd_fm801_mixer_free_ac97; - if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97)) < 0) + err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97); + if (err < 0) return err; if (chip->secondary) { ac97.num = 1; ac97.addr = chip->secondary_addr; - if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_sec)) < 0) + err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_sec); + if (err < 0) return err; } for (i = 0; i < FM801_CONTROLS; i++) @@ -1208,7 +1212,8 @@ static int snd_fm801_create(struct snd_card *card, }; *rchip = NULL; - if ((err = pcim_enable_device(pci)) < 0) + err = pcim_enable_device(pci); + if (err < 0) return err; chip = devm_kzalloc(&pci->dev, sizeof(*chip), GFP_KERNEL); if (chip == NULL) @@ -1218,7 +1223,8 @@ static int snd_fm801_create(struct snd_card *card, chip->dev = &pci->dev; chip->irq = -1; chip->tea575x_tuner = tea575x_tuner; - if ((err = pci_request_regions(pci, "FM801")) < 0) + err = pci_request_regions(pci, "FM801"); + if (err < 0) return err; chip->port = pci_resource_start(pci, 0); @@ -1248,7 +1254,8 @@ static int snd_fm801_create(struct snd_card *card, snd_fm801_chip_init(chip); - if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { + err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); + if (err < 0) { snd_fm801_free(chip); return err; } @@ -1321,7 +1328,10 @@ static int snd_card_fm801_probe(struct pci_dev *pci, 0, &card); if (err < 0) return err; - if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], radio_nr[dev], &chip)) < 0) { + + err = snd_fm801_create(card, pci, tea575x_tuner[dev], radio_nr[dev], + &chip); + if (err < 0) { snd_card_free(card); return err; } @@ -1336,35 +1346,40 @@ static int snd_card_fm801_probe(struct pci_dev *pci, if (chip->tea575x_tuner & TUNER_ONLY) goto __fm801_tuner_only; - if ((err = snd_fm801_pcm(chip, 0)) < 0) { + err = snd_fm801_pcm(chip, 0); + if (err < 0) { snd_card_free(card); return err; } - if ((err = snd_fm801_mixer(chip)) < 0) { + err = snd_fm801_mixer(chip); + if (err < 0) { snd_card_free(card); return err; } - if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_FM801, - chip->port + FM801_MPU401_DATA, - MPU401_INFO_INTEGRATED | - MPU401_INFO_IRQ_HOOK, - -1, &chip->rmidi)) < 0) { + err = snd_mpu401_uart_new(card, 0, MPU401_HW_FM801, + chip->port + FM801_MPU401_DATA, + MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK, + -1, &chip->rmidi); + if (err < 0) { snd_card_free(card); return err; } - if ((err = snd_opl3_create(card, chip->port + FM801_OPL3_BANK0, - chip->port + FM801_OPL3_BANK1, - OPL3_HW_OPL3_FM801, 1, &opl3)) < 0) { + err = snd_opl3_create(card, chip->port + FM801_OPL3_BANK0, + chip->port + FM801_OPL3_BANK1, + OPL3_HW_OPL3_FM801, 1, &opl3); + if (err < 0) { snd_card_free(card); return err; } - if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { + err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); + if (err < 0) { snd_card_free(card); return err; } __fm801_tuner_only: - if ((err = snd_card_register(card)) < 0) { + err = snd_card_register(card); + if (err < 0) { snd_card_free(card); return err; }