Re: [PATCH 5.10 137/173] ALSA: ymfpci: Fix assignment in if condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux