mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 00:21:59 +00:00
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>
This commit is contained in:
parent
9e5341b92d
commit
265a02478d
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user