ALSA - hda: hdmi check NULL pointer in hdmi_set_chmap
authorLibin Yang <libin.yang@linux.intel.com>
Mon, 18 Apr 2016 01:16:28 +0000 (09:16 +0800)
committerTakashi Iwai <tiwai@suse.de>
Mon, 18 Apr 2016 05:27:08 +0000 (07:27 +0200)
Make sure per_pin is not NULL before using it.

Fixes: 9b3dc8aa3fb1 ('ALSA: hda - Register chmap obj as priv data instead of codec')
Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_hdmi.c

index c83c1a8d9742b8f2da261f416561111cb64bd662..40933aa33afe337821570176e93cc9cbb71a8c28 100644 (file)
@@ -1858,6 +1858,8 @@ static void hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx,
        struct hdmi_spec *spec = codec->spec;
        struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx);
 
+       if (!per_pin)
+               return;
        mutex_lock(&per_pin->lock);
        per_pin->chmap_set = true;
        memcpy(per_pin->chmap, chmap, ARRAY_SIZE(per_pin->chmap));