summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-09-21 11:26:21 +0200
committerTakashi Iwai <tiwai@suse.de>2010-09-21 11:26:21 +0200
commit265a02478db5217eda8063004ded1ef0a461c240 (patch)
tree2f6dc49ca61476910903a918ac19bddaa8498e14
parent9e5341b92d1d2dde11691b394721b45b36416bef (diff)
downloadop-kernel-dev-265a02478db5217eda8063004ded1ef0a461c240.zip
op-kernel-dev-265a02478db5217eda8063004ded1ef0a461c240.tar.gz
ALSA: hda - Check invalid NIDs in alc_init_jacks()
The headphone and external-mic pin NIDs can be null, and the jack input elements should be skipped in such a case. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_realtek.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9bedca0..f5ccba0 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1087,15 +1087,19 @@ static int alc_init_jacks(struct hda_codec *codec)
unsigned int hp_nid = spec->autocfg.hp_pins[0];
unsigned int mic_nid = spec->ext_mic.pin;
- err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE);
- if (err < 0)
- return err;
- alc_report_jack(codec, hp_nid);
+ if (hp_nid) {
+ err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE);
+ if (err < 0)
+ return err;
+ alc_report_jack(codec, hp_nid);
+ }
- err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE);
- if (err < 0)
- return err;
- alc_report_jack(codec, mic_nid);
+ if (mic_nid) {
+ err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE);
+ if (err < 0)
+ return err;
+ alc_report_jack(codec, mic_nid);
+ }
return 0;
}
OpenPOWER on IntegriCloud