[alsa-devel] [PATCH 3/4] ALSA: hda - hdmi jack created based on pcm
Yang, Libin
libin.yang at intel.com
Fri Jan 8 08:52:17 CET 2016
> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai at suse.de]
> Sent: Friday, January 08, 2016 3:44 PM
> To: Yang, Libin
> Cc: libin.yang at linux.intel.com; alsa-devel at alsa-project.org; Lin,
> Mengdong
> Subject: Re: [alsa-devel] [PATCH 3/4] ALSA: hda - hdmi jack created based
> on pcm
>
> 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.
I see. It will be:
+for (pcm_idx = 0; pcm_idx < spec->pcm_used; pcm_idx++) {
+ if (spec->pcm_rec[pcm_idx].jack == NULL)
+ continue;
+ if (spec->dyn_pcm_assign)
BTW: It seems snd_device_free() will check the pointer.
Regards,
Libin
> Takashi
More information about the Alsa-devel
mailing list