Commit 60a6a842 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Fix Oops with Realtek quirks with NULL adc_nids

Somce quirk models don't set adc_nids but let the parser filling it.
But the recent code has unnecessary NULL-checks of spec->input_mux,
and it resulted in NULL dereferences.
This patch fixes that regression.
Reported-and-tested-by: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 767cd365
......@@ -1911,7 +1911,7 @@ static int alc_build_controls(struct hda_codec *codec)
return err;
}
}
if (spec->cap_mixer) {
if (spec->cap_mixer && spec->adc_nids) {
const char *kname = kctl ? kctl->id.name : NULL;
for (knew = spec->cap_mixer; knew->name; knew++) {
if (kname && strcmp(knew->name, kname) == 0)
......@@ -3677,7 +3677,7 @@ static int patch_alc880(struct hda_codec *codec)
if (board_config != ALC_MODEL_AUTO)
setup_preset(codec, &alc880_presets[board_config]);
if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
if (!spec->no_analog && !spec->adc_nids) {
alc_auto_fill_adc_caps(codec);
alc_rebuild_imux_for_auto_mic(codec);
alc_remove_invalid_adc_nids(codec);
......@@ -3804,7 +3804,7 @@ static int patch_alc260(struct hda_codec *codec)
if (board_config != ALC_MODEL_AUTO)
setup_preset(codec, &alc260_presets[board_config]);
if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
if (!spec->no_analog && !spec->adc_nids) {
alc_auto_fill_adc_caps(codec);
alc_rebuild_imux_for_auto_mic(codec);
alc_remove_invalid_adc_nids(codec);
......@@ -3983,7 +3983,7 @@ static int patch_alc882(struct hda_codec *codec)
if (board_config != ALC_MODEL_AUTO)
setup_preset(codec, &alc882_presets[board_config]);
if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
if (!spec->no_analog && !spec->adc_nids) {
alc_auto_fill_adc_caps(codec);
alc_rebuild_imux_for_auto_mic(codec);
alc_remove_invalid_adc_nids(codec);
......@@ -4137,7 +4137,7 @@ static int patch_alc262(struct hda_codec *codec)
if (board_config != ALC_MODEL_AUTO)
setup_preset(codec, &alc262_presets[board_config]);
if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
if (!spec->no_analog && !spec->adc_nids) {
alc_auto_fill_adc_caps(codec);
alc_rebuild_imux_for_auto_mic(codec);
alc_remove_invalid_adc_nids(codec);
......@@ -4293,7 +4293,7 @@ static int patch_alc268(struct hda_codec *codec)
(0 << AC_AMPCAP_MUTE_SHIFT));
}
if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
if (!spec->no_analog && !spec->adc_nids) {
alc_auto_fill_adc_caps(codec);
alc_rebuild_imux_for_auto_mic(codec);
alc_remove_invalid_adc_nids(codec);
......@@ -4705,7 +4705,7 @@ static int patch_alc269(struct hda_codec *codec)
if (board_config != ALC_MODEL_AUTO)
setup_preset(codec, &alc269_presets[board_config]);
if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
if (!spec->no_analog && !spec->adc_nids) {
alc_auto_fill_adc_caps(codec);
alc_rebuild_imux_for_auto_mic(codec);
alc_remove_invalid_adc_nids(codec);
......@@ -4843,7 +4843,7 @@ static int patch_alc861(struct hda_codec *codec)
if (board_config != ALC_MODEL_AUTO)
setup_preset(codec, &alc861_presets[board_config]);
if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
if (!spec->no_analog && !spec->adc_nids) {
alc_auto_fill_adc_caps(codec);
alc_rebuild_imux_for_auto_mic(codec);
alc_remove_invalid_adc_nids(codec);
......@@ -4984,7 +4984,7 @@ static int patch_alc861vd(struct hda_codec *codec)
add_verb(spec, alc660vd_eapd_verbs);
}
if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
if (!spec->no_analog && !spec->adc_nids) {
alc_auto_fill_adc_caps(codec);
alc_rebuild_imux_for_auto_mic(codec);
alc_remove_invalid_adc_nids(codec);
......@@ -5200,7 +5200,7 @@ static int patch_alc662(struct hda_codec *codec)
if (board_config != ALC_MODEL_AUTO)
setup_preset(codec, &alc662_presets[board_config]);
if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
if (!spec->no_analog && !spec->adc_nids) {
alc_auto_fill_adc_caps(codec);
alc_rebuild_imux_for_auto_mic(codec);
alc_remove_invalid_adc_nids(codec);
......@@ -5336,7 +5336,7 @@ static int patch_alc680(struct hda_codec *codec)
#endif
}
if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
if (!spec->no_analog && !spec->adc_nids) {
alc_auto_fill_adc_caps(codec);
alc_rebuild_imux_for_auto_mic(codec);
alc_remove_invalid_adc_nids(codec);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment