From 73e77ba0235532bd7523ba90883d325f6e095acf Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 17 Nov 2005 17:44:01 +0100 Subject: [ALSA] Add error messages Add error messages in the critial error path to be more verbose. Signed-off-by: Takashi Iwai --- sound/core/pcm.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'sound/core/pcm.c') diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 59c995bbf15..9305ac357a3 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -600,14 +600,18 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) pstr->reg = &snd_pcm_reg[stream]; if (substream_count > 0) { err = snd_pcm_stream_proc_init(pstr); - if (err < 0) + if (err < 0) { + snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n"); return err; + } } prev = NULL; for (idx = 0, prev = NULL; idx < substream_count; idx++) { substream = kzalloc(sizeof(*substream), GFP_KERNEL); - if (substream == NULL) + if (substream == NULL) { + snd_printk(KERN_ERR "Cannot allocate PCM substream\n"); return -ENOMEM; + } substream->pcm = pcm; substream->pstr = pstr; substream->number = idx; @@ -620,6 +624,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) prev->next = substream; err = snd_pcm_substream_proc_init(substream); if (err < 0) { + snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n"); kfree(substream); return err; } @@ -666,13 +671,14 @@ int snd_pcm_new(struct snd_card *card, char *id, int device, *rpcm = NULL; snd_assert(card != NULL, return -ENXIO); pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); - if (pcm == NULL) + if (pcm == NULL) { + snd_printk(KERN_ERR "Cannot allocate PCM\n"); return -ENOMEM; + } pcm->card = card; pcm->device = device; - if (id) { + if (id) strlcpy(pcm->id, id, sizeof(pcm->id)); - } if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) { snd_pcm_free(pcm); return err; -- cgit v1.2.3-18-g5258