Commit 029fd1ea authored by Takashi Iwai's avatar Takashi Iwai

ALSA: vx222: Fix assignment in if condition

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.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 34b946ee
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment