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

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

 



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
> 
> 
> 
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux