diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-06-11 05:24:58 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-06-11 05:24:58 -0400 |
commit | fbe618f216830f47b183858c3380d4767b1ad02f (patch) | |
tree | 3c880b6874eda86f047f6ec837737a177a02d8fa /sound | |
parent | ab669967d0ecf784567843180e715ccb0e42db36 (diff) |
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: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index fc767b6b4785..f6cd8ed3272f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -2619,16 +2619,18 @@ static int alc_build_controls(struct hda_codec *codec) | |||
2619 | } | 2619 | } |
2620 | 2620 | ||
2621 | /* assign Capture Source enums to NID */ | 2621 | /* assign Capture Source enums to NID */ |
2622 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); | 2622 | if (spec->capsrc_nids || spec->adc_nids) { |
2623 | if (!kctl) | 2623 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
2624 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | 2624 | if (!kctl) |
2625 | for (i = 0; kctl && i < kctl->count; i++) { | 2625 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
2626 | hda_nid_t *nids = spec->capsrc_nids; | 2626 | for (i = 0; kctl && i < kctl->count; i++) { |
2627 | if (!nids) | 2627 | hda_nid_t *nids = spec->capsrc_nids; |
2628 | nids = spec->adc_nids; | 2628 | if (!nids) |
2629 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | 2629 | nids = spec->adc_nids; |
2630 | if (err < 0) | 2630 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
2631 | return err; | 2631 | if (err < 0) |
2632 | return err; | ||
2633 | } | ||
2632 | } | 2634 | } |
2633 | if (spec->cap_mixer) { | 2635 | if (spec->cap_mixer) { |
2634 | const char *kname = kctl ? kctl->id.name : NULL; | 2636 | const char *kname = kctl ? kctl->id.name : NULL; |