[PATCH v2 04/14] staging: most: sound: introduce new sound adapter management

Christian.Gromm at microchip.com Christian.Gromm at microchip.com
Fri Mar 29 09:35:48 UTC 2019


On Do, 2019-03-28 at 16:56 +0300, Dan Carpenter wrote:
> External E-Mail
> 
> 
> On Thu, Mar 28, 2019 at 02:17:32PM +0100, Christian Gromm wrote:
> > 
> > +static int audio_create_sound_card(void)
> > +{
> > +	int ret;
> > +	struct sound_adapter *adpt;
> > +
> > +	list_for_each_entry(adpt, &adpt_list, list) {
> > +		if (!adpt->registered)
> > +			goto adpt_alloc;
> > +	}
> > +	return -ENODEV;
> > +adpt_alloc:
> > +	ret = snd_card_register(adpt->card);
> > +	if (ret < 0) {
> > +		release_adapter(adpt);
> This doesn't feel right.  We didn't acquire "adpt" in this function
> so
> why are we releasing it here.  Do we release it somewhere else as
> well?
> 

We release the adapter, because it is useless if we have not been
able to register it with ALSA.

And yes, it is also being removed, when a channel gets disconnected.

> It's still on the list...

It is being removed from the list inside the function
release_adapter.

thanks,
Chris

> 
> > 
> > +		return ret;
> > +	}
> > +	adpt->registered = true;
> > +	return ret;
> > +}
> regards,
> dan carpenter
> 
> 
> 


More information about the devel mailing list