Commit f8b71635 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Don't access invalid substream in proc file

The commit e3303235
"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: default avatarTakashi Iwai <tiwai@suse.de>
parent a2f6309e
...@@ -316,11 +316,11 @@ static void print_audio_io(struct snd_info_buffer *buffer, ...@@ -316,11 +316,11 @@ static void print_audio_io(struct snd_info_buffer *buffer,
for (type = 0; type < 2; type++) { for (type = 0; type < 2; type++) {
if (cpcm->stream[type].nid != nid || cpcm->pcm == NULL) if (cpcm->stream[type].nid != nid || cpcm->pcm == NULL)
continue; continue;
snd_iprintf(buffer, " Device: name=\"%s\", type=\"%s\", device=%i, substream=%i\n", snd_iprintf(buffer, " Device: name=\"%s\", "
cpcm->name, "type=\"%s\", device=%i\n",
snd_hda_pcm_type_name[cpcm->pcm_type], cpcm->name,
cpcm->pcm->device, snd_hda_pcm_type_name[cpcm->pcm_type],
cpcm->pcm->streams[type].substream->number); cpcm->pcm->device);
} }
} }
conv = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); conv = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment