Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 265a0247 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

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: default avatarTakashi Iwai <tiwai@suse.de>
parent 9e5341b9
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -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;
	if (hp_nid) {
		err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE);
		if (err < 0)
			return err;
		alc_report_jack(codec, hp_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;
}