summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 17:44:01 +0100
committerJaroslav Kysela <perex@suse.cz>2006-01-03 12:28:58 +0100
commit73e77ba0235532bd7523ba90883d325f6e095acf (patch)
treed22f29805ade9e78bd5f1802590d42f6e121c3c1 /sound/core
parent00a4e3d9f8df8a90966b75d517154718b4a2242a (diff)
downloadlinux-stable-73e77ba0235532bd7523ba90883d325f6e095acf.tar.gz
linux-stable-73e77ba0235532bd7523ba90883d325f6e095acf.tar.bz2
linux-stable-73e77ba0235532bd7523ba90883d325f6e095acf.zip
[ALSA] Add error messages
Add error messages in the critial error path to be more verbose. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/control.c8
-rw-r--r--sound/core/device.c5
-rw-r--r--sound/core/hwdep.c7
-rw-r--r--sound/core/pcm.c16
-rw-r--r--sound/core/rawmidi.c18
-rw-r--r--sound/core/timer.c4
6 files changed, 42 insertions, 16 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 03ae9bb7d38e..f8f98cc52417 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -195,8 +195,10 @@ struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control, unsigned int acce
snd_assert(control != NULL, return NULL);
snd_assert(control->count > 0, return NULL);
kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL);
- if (kctl == NULL)
+ if (kctl == NULL) {
+ snd_printk(KERN_ERR "Cannot allocate control instance\n");
return NULL;
+ }
*kctl = *control;
for (idx = 0; idx < kctl->count; idx++)
kctl->vd[idx].access = access;
@@ -309,7 +311,9 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
struct snd_ctl_elem_id id;
unsigned int idx;
- snd_assert(card != NULL && kcontrol != NULL, return -EINVAL);
+ snd_assert(card != NULL, return -EINVAL);
+ if (! kcontrol)
+ return -EINVAL;
snd_assert(kcontrol->info != NULL, return -EINVAL);
id = kcontrol->id;
down_write(&card->controls_rwsem);
diff --git a/sound/core/device.c b/sound/core/device.c
index afa8cc7fb05e..b1cf6ec56784 100644
--- a/sound/core/device.c
+++ b/sound/core/device.c
@@ -50,8 +50,10 @@ int snd_device_new(struct snd_card *card, snd_device_type_t type,
snd_assert(device_data != NULL, return -ENXIO);
snd_assert(ops != NULL, return -ENXIO);
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
- if (dev == NULL)
+ if (dev == NULL) {
+ snd_printk(KERN_ERR "Cannot allocate device\n");
return -ENOMEM;
+ }
dev->card = card;
dev->type = type;
dev->state = SNDRV_DEV_BUILD;
@@ -173,6 +175,7 @@ int snd_device_register(struct snd_card *card, void *device_data)
dev->state = SNDRV_DEV_REGISTERED;
return 0;
}
+ snd_printd("snd_device_register busy\n");
return -EBUSY;
}
snd_BUG();
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index da0fb9f08413..444e266e7c48 100644
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -364,13 +364,14 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
*rhwdep = NULL;
snd_assert(card != NULL, return -ENXIO);
hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
- if (hwdep == NULL)
+ if (hwdep == NULL) {
+ snd_printk(KERN_ERR "hwdep: cannot allocate\n");
return -ENOMEM;
+ }
hwdep->card = card;
hwdep->device = device;
- if (id) {
+ if (id)
strlcpy(hwdep->id, id, sizeof(hwdep->id));
- }
#ifdef CONFIG_SND_OSSEMUL
hwdep->oss_type = -1;
#endif
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 59c995bbf15b..9305ac357a3e 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;
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index ede0a6083d29..7a86a9a08a15 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -1382,8 +1382,10 @@ static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
INIT_LIST_HEAD(&stream->substreams);
for (idx = 0; idx < count; idx++) {
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
- if (substream == NULL)
+ if (substream == NULL) {
+ snd_printk(KERN_ERR "rawmidi: cannot allocate substream\n");
return -ENOMEM;
+ }
substream->stream = direction;
substream->number = idx;
substream->rmidi = rmidi;
@@ -1425,19 +1427,27 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
*rrawmidi = NULL;
snd_assert(card != NULL, return -ENXIO);
rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
- if (rmidi == NULL)
+ if (rmidi == NULL) {
+ snd_printk(KERN_ERR "rawmidi: cannot allocate\n");
return -ENOMEM;
+ }
rmidi->card = card;
rmidi->device = device;
init_MUTEX(&rmidi->open_mutex);
init_waitqueue_head(&rmidi->open_wait);
if (id != NULL)
strlcpy(rmidi->id, id, sizeof(rmidi->id));
- if ((err = snd_rawmidi_alloc_substreams(rmidi, &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT], SNDRV_RAWMIDI_STREAM_INPUT, input_count)) < 0) {
+ if ((err = snd_rawmidi_alloc_substreams(rmidi,
+ &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT],
+ SNDRV_RAWMIDI_STREAM_INPUT,
+ input_count)) < 0) {
snd_rawmidi_free(rmidi);
return err;
}
- if ((err = snd_rawmidi_alloc_substreams(rmidi, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT], SNDRV_RAWMIDI_STREAM_OUTPUT, output_count)) < 0) {
+ if ((err = snd_rawmidi_alloc_substreams(rmidi,
+ &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT],
+ SNDRV_RAWMIDI_STREAM_OUTPUT,
+ output_count)) < 0) {
snd_rawmidi_free(rmidi);
return err;
}
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 18d43a037850..74637cef6d2c 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -777,8 +777,10 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
snd_assert(rtimer != NULL, return -EINVAL);
*rtimer = NULL;
timer = kzalloc(sizeof(*timer), GFP_KERNEL);
- if (timer == NULL)
+ if (timer == NULL) {
+ snd_printk(KERN_ERR "timer: cannot allocate\n");
return -ENOMEM;
+ }
timer->tmr_class = tid->dev_class;
timer->card = card;
timer->tmr_device = tid->device;