commit b1b2c798b2943c887bd063bbe415aa2e48923817 Author: Sven Schnelle Date: Tue Feb 6 09:17:18 2018 +0100 ALSA: hda: check eld_ctl pointer before using it Signed-off-by: Sven Schnelle diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index b4f1b6e88305..7efe0dc26c7c 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -1433,6 +1433,7 @@ static void update_eld(struct hda_codec *codec, { struct hdmi_eld *pin_eld = &per_pin->sink_eld; struct hdmi_spec *spec = codec->spec; + struct snd_kcontrol *eld_ctl; bool old_eld_valid = pin_eld->eld_valid; bool eld_changed; int pcm_idx = -1; @@ -1482,11 +1483,13 @@ static void update_eld(struct hda_codec *codec, hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm); } - if (eld_changed && pcm_idx >= 0) + eld_ctl = get_hdmi_pcm(spec, pcm_idx)->eld_ctl; + if (eld_changed && pcm_idx >= 0 && eld_ctl) { snd_ctl_notify(codec->card, SNDRV_CTL_EVENT_MASK_VALUE | SNDRV_CTL_EVENT_MASK_INFO, - &get_hdmi_pcm(spec, pcm_idx)->eld_ctl->id); + &eld_ctl->id); + } } /* update ELD and jack state via HD-audio verbs */