From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH 3/4] ALSA: hda - hdmi jack created based on pcm Date: Fri, 08 Jan 2016 08:43:58 +0100 Message-ID: References: <1451524942-17288-1-git-send-email-libin.yang@linux.intel.com> <1451524942-17288-4-git-send-email-libin.yang@linux.intel.com> <96A12704CE18D347B625EE2D4A099D190464D1BC@SHSMSX103.ccr.corp.intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id E26642604AA for ; Fri, 8 Jan 2016 08:43:59 +0100 (CET) In-Reply-To: <96A12704CE18D347B625EE2D4A099D190464D1BC@SHSMSX103.ccr.corp.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: "Yang, Libin" Cc: "Lin, Mengdong" , "libin.yang@linux.intel.com" , "alsa-devel@alsa-project.org" List-Id: alsa-devel@alsa-project.org 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