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