[alsa-devel] [PATCH 3/4] ALSA: hda - hdmi jack created based on pcm

Takashi Iwai tiwai at suse.de
Fri Jan 8 08:43:58 CET 2016


On Fri, 08 Jan 2016 04:15:03 +0100,
Yang, Libin wrote:
> > > @@ -2626,18 +2659,23 @@ static void hdmi_array_free(struct
> > hdmi_spec *spec)
> > >  static void generic_hdmi_free(struct hda_codec *codec)
> > >  {
> > >  	struct hdmi_spec *spec = codec->spec;
> > > -	int pin_idx;
> > > +	int pin_idx, pcm_idx;
> > >
> > >  	if (codec_has_acomp(codec))
> > >  		snd_hdac_i915_register_notifier(NULL);
> > >
> > >  	for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
> > >  		struct hdmi_spec_per_pin *per_pin = get_pin(spec,
> > pin_idx);
> > > -
> > >  		cancel_delayed_work_sync(&per_pin->work);
> > >  		eld_proc_free(per_pin);
> > > -		if (per_pin->acomp_jack)
> > > -			snd_device_free(codec->card, per_pin-
> > >acomp_jack);
> > > +	}
> > > +
> > > +	for (pcm_idx = 0; pcm_idx < spec->pcm_used; pcm_idx++) {
> > > +		if (spec->dyn_pcm_assign)
> > > +			snd_device_free(codec->card,
> > > +					spec->pcm_rec[pcm_idx].jack);
> > > +		else
> > > +			spec->pcm_rec[pcm_idx].jack = NULL;
> > 
> > Check whether spec->pcm_rec[pcm_idx].jack is NULL beforehand.
> > 
> 
> Do you mean:
> if (spec->pcm_rec[pcm_idx].jack)
>     spec->pcm_rec[pcm_idx].jack = NULL;

Not only that.  Calling snd_device_free() with NULL isn't allowed.


Takashi


More information about the Alsa-devel mailing list