Hi!
PCI YMFPCI 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.
I believe I see functional changes there.
@@ -250,9 +259,8 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, pci_read_config_word(pci, PCIR_DSXG_LEGACY, &old_legacy_ctrl); pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl); pci_write_config_word(pci, PCIR_DSXG_ELEGACY, legacy_ctrl2);
- if ((err = snd_ymfpci_create(card, pci,
old_legacy_ctrl,
&chip)) < 0) {
- err = snd_ymfpci_create(card, pci, old_legacy_ctrl, &chip);
- if (err < 0) { release_and_free_resource(mpu_res);
Whitespace could be fixed here.
@@ -1814,27 +1826,37 @@ int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch) /* add S/PDIF control */ if (snd_BUG_ON(!chip->pcm_spdif)) return -ENXIO;
- if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_default, chip))) < 0)
- kctl = snd_ctl_new1(&snd_ymfpci_spdif_default, chip);
- err = snd_ctl_add(chip->card, kctl);
- if (err < 0) return err;
Old code discarded err value and tested just kctl error. New code tests just err. I guess we should test both.
kctl->id.device = chip->pcm_spdif->device;
- if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_mask, chip))) < 0)
- kctl = snd_ctl_new1(&snd_ymfpci_spdif_mask, chip);
- err = snd_ctl_add(chip->card, kctl);
- if (err < 0) return err; kctl->id.device = chip->pcm_spdif->device;
- if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_stream, chip))) < 0)
- kctl = snd_ctl_new1(&snd_ymfpci_spdif_stream, chip);
- err = snd_ctl_add(chip->card, kctl);
- if (err < 0) return err;
Same here.
/* direct recording source */
- if (chip->device_id == PCI_DEVICE_ID_YAMAHA_754 &&
(err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_drec_source, chip))) < 0)
return err;
- if (chip->device_id == PCI_DEVICE_ID_YAMAHA_754) {
kctl = snd_ctl_new1(&snd_ymfpci_drec_source, chip);
err = snd_ctl_add(chip->card, kctl);
if (err < 0)
return err;
- }
And here.
Best regards, Pavel