Commit d8d881dd authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Fix NULL dereference with enable_beep=0 option

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent de8853bc
...@@ -3779,17 +3779,18 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out ...@@ -3779,17 +3779,18 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
err = snd_hda_attach_beep_device(codec, nid); err = snd_hda_attach_beep_device(codec, nid);
if (err < 0) if (err < 0)
return err; return err;
if (codec->beep) {
/* IDT/STAC codecs have linear beep tone parameter */ /* IDT/STAC codecs have linear beep tone parameter */
codec->beep->linear_tone = 1; codec->beep->linear_tone = 1;
/* if no beep switch is available, make its own one */ /* if no beep switch is available, make its own one */
caps = query_amp_caps(codec, nid, HDA_OUTPUT); caps = query_amp_caps(codec, nid, HDA_OUTPUT);
if (codec->beep && if (!(caps & AC_AMPCAP_MUTE)) {
!((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) {
err = stac92xx_beep_switch_ctl(codec); err = stac92xx_beep_switch_ctl(codec);
if (err < 0) if (err < 0)
return err; return err;
} }
} }
}
#endif #endif
err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment