From: Takashi Iwai <tiwai@suse.de>
To: "Yang, Libin" <libin.yang@intel.com>
Cc: "Lin, Mengdong" <mengdong.lin@intel.com>,
"libin.yang@linux.intel.com" <libin.yang@linux.intel.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: [PATCH 3/4] ALSA: hda - hdmi jack created based on pcm
Date: Fri, 08 Jan 2016 08:54:42 +0100 [thread overview]
Message-ID: <s5h7fjk8q0t.wl-tiwai@suse.de> (raw)
In-Reply-To: <96A12704CE18D347B625EE2D4A099D190464D2B0@SHSMSX103.ccr.corp.intel.com>
On Fri, 08 Jan 2016 08:52:17 +0100,
Yang, Libin wrote:
>
>
> > -----Original Message-----
> > From: Takashi Iwai [mailto:tiwai@suse.de]
> > Sent: Friday, January 08, 2016 3:44 PM
> > To: Yang, Libin
> > Cc: libin.yang@linux.intel.com; alsa-devel@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.
Yes but with snd_BUG_ON(), i.e. with a warning. It shouldn't be
called with NULL.
Takashi
next prev parent reply other threads:[~2016-01-08 7:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-31 1:22 [PATCH 0/4] ALSA: hda - hdmi jack support for dynamic pcm assignment libin.yang
2015-12-31 1:22 ` [PATCH 1/4] ALSA: Add documentation about HD-audio DP MST libin.yang
2015-12-31 1:22 ` [PATCH 2/4] ALSA: hda - add hdmi_pcm to manage hdmi pcm related features libin.yang
2016-01-07 13:59 ` Takashi Iwai
2016-01-08 2:48 ` Yang, Libin
2015-12-31 1:22 ` [PATCH 3/4] ALSA: hda - hdmi jack created based on pcm libin.yang
2016-01-07 14:13 ` Takashi Iwai
2016-01-08 3:15 ` Yang, Libin
2016-01-08 7:43 ` Takashi Iwai
2016-01-08 7:52 ` Yang, Libin
2016-01-08 7:54 ` Takashi Iwai [this message]
2016-01-08 7:57 ` Yang, Libin
2015-12-31 1:22 ` [PATCH 4/4] ALSA: hda - hdmi monitor hotplug support for dynamic pcm assignment libin.yang
2016-01-07 14:18 ` Takashi Iwai
2016-01-08 5:25 ` Yang, Libin
2016-01-08 7:45 ` Takashi Iwai
2016-01-08 7:53 ` Yang, Libin
2016-01-06 9:18 ` [PATCH 0/4] ALSA: hda - hdmi jack " Takashi Iwai
2016-01-07 1:41 ` Yang, Libin
2016-01-07 10:31 ` Takashi Iwai
2016-01-08 2:47 ` Yang, Libin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5h7fjk8q0t.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=libin.yang@intel.com \
--cc=libin.yang@linux.intel.com \
--cc=mengdong.lin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox