ALSA: hda - Don't access invalid substream in proc file
authorTakashi Iwai <tiwai@suse.de>
Thu, 12 Nov 2009 08:50:28 +0000 (09:50 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 12 Nov 2009 08:50:28 +0000 (09:50 +0100)
The commit e3303235209c0496b490e10ab131e72a9568c153
"ALSA: hda - proc - show which I/O NID is associated to PCM device"
introduces the access to substream pointer.  But, PCMs may have no
substreams in one or both directions, and this results in NULL
dereference.  Also, print the first substream number doesn't make
sense.

This patch removes the access to the substream pointer, and reformat
to fit to the standard coding style.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_proc.c

index f5639c2988abd0356d50a1e96aef8662e86eb3f0..f5b783ce450db48d13fed2b2e462f28e6b6db763 100644 (file)
@@ -316,11 +316,11 @@ static void print_audio_io(struct snd_info_buffer *buffer,
                for (type = 0; type < 2; type++) {
                        if (cpcm->stream[type].nid != nid || cpcm->pcm == NULL)
                                continue;
-                       snd_iprintf(buffer, "  Device: name=\"%s\", type=\"%s\", device=%i, substream=%i\n",
-                               cpcm->name,
-                               snd_hda_pcm_type_name[cpcm->pcm_type],
-                               cpcm->pcm->device,
-                               cpcm->pcm->streams[type].substream->number);
+                       snd_iprintf(buffer, "  Device: name=\"%s\", "
+                                   "type=\"%s\", device=%i\n",
+                                   cpcm->name,
+                                   snd_hda_pcm_type_name[cpcm->pcm_type],
+                                   cpcm->pcm->device);
                }
        }
        conv = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0);