]> www.infradead.org Git - nvme.git/commitdiff
ALSA: nm256: Fix assignment in if condition
authorTakashi Iwai <tiwai@suse.de>
Tue, 8 Jun 2021 14:05:19 +0000 (16:05 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 9 Jun 2021 15:30:16 +0000 (17:30 +0200)
PCI NM256 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-46-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/nm256/nm256.c

index 6cb689aa28c21a40bfa9c1d906666d777c251381..12d02d7d3b5140d2bdbd0f117ae30139f8037cd3 100644 (file)
@@ -1318,7 +1318,8 @@ snd_nm256_mixer(struct nm256 *chip)
        if (! chip->ac97_regs)
                return -ENOMEM;
 
-       if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus)) < 0)
+       err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus);
+       if (err < 0)
                return err;
 
        memset(&ac97, 0, sizeof(ac97));
@@ -1476,7 +1477,8 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
 
        *chip_ret = NULL;
 
-       if ((err = pci_enable_device(pci)) < 0)
+       err = pci_enable_device(pci);
+       if (err < 0)
                return err;
 
        chip = kzalloc(sizeof(*chip), GFP_KERNEL);
@@ -1568,7 +1570,8 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
                chip->buffer_end = buffer_top;
        else {
                /* get buffer end pointer from signature */
-               if ((err = snd_nm256_peek_for_sig(chip)) < 0)
+               err = snd_nm256_peek_for_sig(chip);
+               if (err < 0)
                        goto __error;
        }
 
@@ -1618,7 +1621,8 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
 
        // pci_set_master(pci); /* needed? */
        
-       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)
                goto __error;
 
        *chip_ret = chip;
@@ -1700,7 +1704,8 @@ static int snd_nm256_probe(struct pci_dev *pci,
                capture_bufsize = 4;
        if (capture_bufsize > 128)
                capture_bufsize = 128;
-       if ((err = snd_nm256_create(card, pci, &chip)) < 0) {
+       err = snd_nm256_create(card, pci, &chip);
+       if (err < 0) {
                snd_card_free(card);
                return err;
        }
@@ -1716,8 +1721,13 @@ static int snd_nm256_probe(struct pci_dev *pci,
                chip->reset_workaround_2 = 1;
        }
 
-       if ((err = snd_nm256_pcm(chip, 0)) < 0 ||
-           (err = snd_nm256_mixer(chip)) < 0) {
+       err = snd_nm256_pcm(chip, 0);
+       if (err < 0) {
+               snd_card_free(card);
+               return err;
+       }
+       err = snd_nm256_mixer(chip);
+       if (err < 0) {
                snd_card_free(card);
                return err;
        }
@@ -1727,7 +1737,8 @@ static int snd_nm256_probe(struct pci_dev *pci,
                card->shortname,
                chip->buffer_addr, chip->cport_addr, chip->irq);
 
-       if ((err = snd_card_register(card)) < 0) {
+       err = snd_card_register(card);
+       if (err < 0) {
                snd_card_free(card);
                return err;
        }