ALSA: vx222: Fix assignment in if condition
authorTakashi Iwai <tiwai@suse.de>
Tue, 8 Jun 2021 14:05:25 +0000 (16:05 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 9 Jun 2021 15:30:21 +0000 (17:30 +0200)
PCI VX222 driver code contains lots of 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-52-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/vx222/vx222.c
sound/pci/vx222/vx222_ops.c

index 2a9e1a7..04c7204 100644 (file)
@@ -133,7 +133,8 @@ static int snd_vx222_create(struct snd_card *card, struct pci_dev *pci,
        const struct snd_vx_ops *vx_ops;
 
        /* enable PCI device */
-       if ((err = pci_enable_device(pci)) < 0)
+       err = pci_enable_device(pci);
+       if (err < 0)
                return err;
        pci_set_master(pci);
 
@@ -147,7 +148,8 @@ static int snd_vx222_create(struct snd_card *card, struct pci_dev *pci,
        vx = to_vx222(chip);
        vx->pci = pci;
 
-       if ((err = pci_request_regions(pci, CARD_NAME)) < 0) {
+       err = pci_request_regions(pci, CARD_NAME);
+       if (err < 0) {
                snd_vx222_free(chip);
                return err;
        }
@@ -164,7 +166,8 @@ static int snd_vx222_create(struct snd_card *card, struct pci_dev *pci,
        chip->irq = pci->irq;
        card->sync_irq = chip->irq;
 
-       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_vx222_free(chip);
                return err;
        }
@@ -207,7 +210,8 @@ static int snd_vx222_probe(struct pci_dev *pci,
                        hw = &vx222_v2_hw;
                break;
        }
-       if ((err = snd_vx222_create(card, pci, hw, &vx)) < 0) {
+       err = snd_vx222_create(card, pci, hw, &vx);
+       if (err < 0) {
                snd_card_free(card);
                return err;
        }
@@ -223,12 +227,14 @@ static int snd_vx222_probe(struct pci_dev *pci,
        vx->core.dev = &pci->dev;
 #endif
 
-       if ((err = snd_vx_setup_firmware(&vx->core)) < 0) {
+       err = snd_vx_setup_firmware(&vx->core);
+       if (err < 0) {
                snd_card_free(card);
                return err;
        }
 
-       if ((err = snd_card_register(card)) < 0) {
+       err = snd_card_register(card);
+       if (err < 0) {
                snd_card_free(card);
                return err;
        }
index a055372..3e7e928 100644 (file)
@@ -408,9 +408,11 @@ static int vx2_load_dsp(struct vx_core *vx, int index, const struct firmware *ds
        switch (index) {
        case 1:
                /* xilinx image */
-               if ((err = vx2_load_xilinx_binary(vx, dsp)) < 0)
+               err = vx2_load_xilinx_binary(vx, dsp);
+               if (err < 0)
                        return err;
-               if ((err = vx2_test_xilinx(vx)) < 0)
+               err = vx2_test_xilinx(vx);
+               if (err < 0)
                        return err;
                return 0;
        case 2:
@@ -972,9 +974,11 @@ static int vx2_add_mic_controls(struct vx_core *_chip)
        vx2_set_input_level(chip);
 
        /* controls */
-       if ((err = snd_ctl_add(_chip->card, snd_ctl_new1(&vx_control_input_level, chip))) < 0)
+       err = snd_ctl_add(_chip->card, snd_ctl_new1(&vx_control_input_level, chip));
+       if (err < 0)
                return err;
-       if ((err = snd_ctl_add(_chip->card, snd_ctl_new1(&vx_control_mic_level, chip))) < 0)
+       err = snd_ctl_add(_chip->card, snd_ctl_new1(&vx_control_mic_level, chip));
+       if (err < 0)
                return err;
 
        return 0;