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

Commit fbe618f2 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Don't check capture source mixer if no ADC is available

With multiple codec configurations, some codec might have no ADC, thus
it keeps spec->adc_nids = NULL.  This causes an Oops in alc_build_controls().

Reference: kernel bug #16156
	https://bugzilla.kernel.org/show_bug.cgi?id=16156



Cc: <stable@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent ab669967
Loading
Loading
Loading
Loading
+12 −10
Original line number Original line Diff line number Diff line
@@ -2619,6 +2619,7 @@ static int alc_build_controls(struct hda_codec *codec)
	}
	}
	/* assign Capture Source enums to NID */
	/* assign Capture Source enums to NID */
	if (spec->capsrc_nids || spec->adc_nids) {
		kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
		kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
		if (!kctl)
		if (!kctl)
			kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
			kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
@@ -2630,6 +2631,7 @@ static int alc_build_controls(struct hda_codec *codec)
			if (err < 0)
			if (err < 0)
				return err;
				return err;
		}
		}
	}
	if (spec->cap_mixer) {
	if (spec->cap_mixer) {
		const char *kname = kctl ? kctl->id.name : NULL;
		const char *kname = kctl ? kctl->id.name : NULL;
		for (knew = spec->cap_mixer; knew->name; knew++) {
		for (knew = spec->cap_mixer; knew->name; knew++) {