[ALSA] Add error messages
Add error messages in the critial error path to be more verbose.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/sound/core/control.c b/sound/core/control.c
index 03ae9bb..f8f98cc 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -195,8 +195,10 @@
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 @@
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);