Skip to contentSkip to conversation

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

DISCUSSION Takashi Iwai 1 participant 1 message Jul 5, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20100628100958.GH19184@bicker

#1 lore raw

At Mon, 28 Jun 2010 12:09:58 +0200,

Quoted 5 lines · Dan Carpenter

Commit fbe618f2168 "ALSA: hda - Don't check capture source mixer if no ADC is available" added support for when there is no ADC available and spec->adc_nids is NULL. If spec->adc_nids is NULL, can it cause a problem later when we call snd_hda_add_nid()?

If no ADC is available, there shouldn't be spec->cap_mixer, too. So, practically the current code should be OK.
(Here ADC is not only for analog but rather refers to audio-in widget)

thanks,

Takashi

Quoted 21 lines

sound/pci/hda/patch_realtek.c +2643 alc_build_controls(96)

	error: we previously assumed 'spec->adc_nids' could be null.
  2635          if (spec->cap_mixer) {
  2636                  const char *kname = kctl ? kctl->id.name : NULL;
  2637                  for (knew = spec->cap_mixer; knew->name; knew++) {
  2638                          if (kname && strcmp(knew->name, kname) == 0)
  2639                                  continue;
  2640                          kctl = snd_hda_find_mixer_ctl(codec, knew->name);
  2641                          for (i = 0; kctl && i < kctl->count; i++) {
  2642                                  err = snd_hda_add_nid(codec, kctl, i,
  2643							      spec->adc_nids[i]);
                                                              ^^^^^^^^^^^^^^^^^

2644 if (err < 0)
2645 return err;
2646 }
2647 }
2648 }

regards,
dan carpenter