ALSA: cs5535audio: Fix assignment in if condition
authorTakashi Iwai <tiwai@suse.de>
Tue, 8 Jun 2021 14:05:12 +0000 (16:05 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 9 Jun 2021 15:30:07 +0000 (17:30 +0200)
PCI CS5535 driver code contains a few assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.

This patch is merely for coding-style fixes, no functional changes.

Link: https://lore.kernel.org/r/20210608140540.17885-39-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/cs5535audio/cs5535audio.c
sound/pci/cs5535audio/cs5535audio_pcm.c

index 9b716b56d7392d001804770df449371e24d4eca7..e048b45d9e7eeb16dadb83cca23c375707125c2d 100644 (file)
@@ -143,7 +143,8 @@ static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
                .read = snd_cs5535audio_ac97_codec_read,
        };
 
-       if ((err = snd_ac97_bus(card, 0, &ops, NULL, &pbus)) < 0)
+       err = snd_ac97_bus(card, 0, &ops, NULL, &pbus);
+       if (err < 0)
                return err;
 
        memset(&ac97, 0, sizeof(ac97));
@@ -155,7 +156,8 @@ static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
        /* set any OLPC-specific scaps */
        olpc_prequirks(card, &ac97);
 
-       if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) {
+       err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97);
+       if (err < 0) {
                dev_err(card->dev, "mixer failed\n");
                return err;
        }
@@ -266,7 +268,8 @@ static int snd_cs5535audio_create(struct snd_card *card,
        };
 
        *rcs5535au = NULL;
-       if ((err = pci_enable_device(pci)) < 0)
+       err = pci_enable_device(pci);
+       if (err < 0)
                return err;
 
        if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32))) {
@@ -286,7 +289,8 @@ static int snd_cs5535audio_create(struct snd_card *card,
        cs5535au->pci = pci;
        cs5535au->irq = -1;
 
-       if ((err = pci_request_regions(pci, "CS5535 Audio")) < 0) {
+       err = pci_request_regions(pci, "CS5535 Audio");
+       if (err < 0) {
                kfree(cs5535au);
                goto pcifail;
        }
@@ -304,8 +308,8 @@ static int snd_cs5535audio_create(struct snd_card *card,
        card->sync_irq = cs5535au->irq;
        pci_set_master(pci);
 
-       if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
-                                 cs5535au, &ops)) < 0)
+       err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, cs5535au, &ops);
+       if (err < 0)
                goto sndfail;
 
        *rcs5535au = cs5535au;
@@ -340,15 +344,18 @@ static int snd_cs5535audio_probe(struct pci_dev *pci,
        if (err < 0)
                return err;
 
-       if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0)
+       err = snd_cs5535audio_create(card, pci, &cs5535au);
+       if (err < 0)
                goto probefail_out;
 
        card->private_data = cs5535au;
 
-       if ((err = snd_cs5535audio_mixer(cs5535au)) < 0)
+       err = snd_cs5535audio_mixer(cs5535au);
+       if (err < 0)
                goto probefail_out;
 
-       if ((err = snd_cs5535audio_pcm(cs5535au)) < 0)
+       err = snd_cs5535audio_pcm(cs5535au);
+       if (err < 0)
                goto probefail_out;
 
        strcpy(card->driver, DRIVER_NAME);
@@ -358,7 +365,8 @@ static int snd_cs5535audio_probe(struct pci_dev *pci,
                card->shortname, card->driver,
                cs5535au->port, cs5535au->irq);
 
-       if ((err = snd_card_register(card)) < 0)
+       err = snd_card_register(card);
+       if (err < 0)
                goto probefail_out;
 
        pci_set_drvdata(pci, card);
index 4032b89b1fc1dbb9cce6ee75d71c95ecc2fa257b..5ff10fec7b903a98e3a48d9766d0d8d7e0e7d783 100644 (file)
@@ -87,8 +87,9 @@ static int snd_cs5535audio_playback_open(struct snd_pcm_substream *substream)
        snd_pcm_limit_hw_rates(runtime);
        cs5535au->playback_substream = substream;
        runtime->private_data = &(cs5535au->dmas[CS5535AUDIO_DMA_PLAYBACK]);
-       if ((err = snd_pcm_hw_constraint_integer(runtime,
-                               SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
+       err = snd_pcm_hw_constraint_integer(runtime,
+                                           SNDRV_PCM_HW_PARAM_PERIODS);
+       if (err < 0)
                return err;
 
        return 0;
@@ -342,8 +343,9 @@ static int snd_cs5535audio_capture_open(struct snd_pcm_substream *substream)
        snd_pcm_limit_hw_rates(runtime);
        cs5535au->capture_substream = substream;
        runtime->private_data = &(cs5535au->dmas[CS5535AUDIO_DMA_CAPTURE]);
-       if ((err = snd_pcm_hw_constraint_integer(runtime,
-                                        SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
+       err = snd_pcm_hw_constraint_integer(runtime,
+                                           SNDRV_PCM_HW_PARAM_PERIODS);
+       if (err < 0)
                return err;
        olpc_capture_open(cs5535au->ac97);
        return 0;