diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-12-22 07:52:49 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-12-22 07:52:49 +0100 |
commit | d8d881dd2c814e1500558889d800cf78d11cf898 (patch) | |
tree | eb17bee1d30305f39a9ee937c4b5d8c469767603 /sound/pci | |
parent | de8853bc38ceab1fa7e7f723b21430d4aad60fea (diff) | |
download | linux-d8d881dd2c814e1500558889d800cf78d11cf898.tar.bz2 |
ALSA: hda - Fix NULL dereference with enable_beep=0 option
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3d59f8325848..417fb22ae83c 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -3779,15 +3779,16 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out err = snd_hda_attach_beep_device(codec, nid); if (err < 0) return err; - /* IDT/STAC codecs have linear beep tone parameter */ - codec->beep->linear_tone = 1; - /* if no beep switch is available, make its own one */ - caps = query_amp_caps(codec, nid, HDA_OUTPUT); - if (codec->beep && - !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { - err = stac92xx_beep_switch_ctl(codec); - if (err < 0) - return err; + if (codec->beep) { + /* IDT/STAC codecs have linear beep tone parameter */ + codec->beep->linear_tone = 1; + /* if no beep switch is available, make its own one */ + caps = query_amp_caps(codec, nid, HDA_OUTPUT); + if (!(caps & AC_AMPCAP_MUTE)) { + err = stac92xx_beep_switch_ctl(codec); + if (err < 0) + return err; + } } } #endif |