Skip to content

Commit

Permalink
ALSA: hda - Don't access invalid substream in proc file
Browse files Browse the repository at this point in the history
The commit e330323
"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>
  • Loading branch information
Takashi Iwai committed Nov 12, 2009
1 parent a2f6309 commit f8b7163
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sound/pci/hda/hda_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f8b7163

Please sign in to comment.