On Tue, 04 Apr 2023 13:39:57 +0200, Pavel Machek wrote: > > > @@ -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. In both cases, only the error from snd_ctl_add() is checked. And it's fine as designed; snd_ctl_add() returns -ENOMEM when NULL kctl is passed. Takashi