ALSA: hda - fix NULL-dereference in patch_realtek
authorRaymond Yau <superquad.vortex2@gmail.com>
Tue, 3 May 2011 05:33:53 +0000 (13:33 +0800)
committerTakashi Iwai <tiwai@suse.de>
Tue, 3 May 2011 08:32:04 +0000 (10:32 +0200)
Fix NULL-dereference when try to use alt_playback since those codecs
which support multistreaming playback usually have more than 1 adc but
the driver should create alt_capture when spec->stream_analog_alt_capture
is also defined.

Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_realtek.c

index c9f77152e079a6f717d60dd4ee1dd5161b737cc0..4dd0cccc5a9ef817d8a8411a72ef42c166422c49 100644 (file)
@@ -4424,7 +4424,7 @@ static int alc_build_pcms(struct hda_codec *codec)
                                alc_pcm_null_stream;
                        info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
                }
-               if (spec->num_adc_nids > 1) {
+               if (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture) {
                        info->stream[SNDRV_PCM_STREAM_CAPTURE] =
                                *spec->stream_analog_alt_capture;
                        info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =