Re: [alsa-devel] ALSA: hda - Don't check capture source mixer if no ADC is available
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()?
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
At Mon, 28 Jun 2010 12:09:58 +0200, Dan Carpenter wrote:
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
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
participants (2)
-
Dan Carpenter
-
Takashi Iwai