aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/hwdep.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-08 11:09:09 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-13 05:46:35 -0400
commit7eaa943c8ed8e91e05d0f5d0dc7a18e3319b45cf (patch)
tree51d86a4cb01cf5735b18c36ca62471f8c759a041 /sound/core/hwdep.c
parent5ef03460a6ffc1d3ee6b6f2abc6765d3e224cf89 (diff)
ALSA: Kill snd_assert() in sound/core/*
Kill snd_assert() in sound/core/*, either removed or replaced with if () with snd_BUG_ON(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/core/hwdep.c')
-rw-r--r--sound/core/hwdep.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index 6d6589f93899..195cafc5a553 100644
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -353,9 +353,10 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
353 .dev_disconnect = snd_hwdep_dev_disconnect, 353 .dev_disconnect = snd_hwdep_dev_disconnect,
354 }; 354 };
355 355
356 snd_assert(rhwdep != NULL, return -EINVAL); 356 if (snd_BUG_ON(!card))
357 *rhwdep = NULL; 357 return -ENXIO;
358 snd_assert(card != NULL, return -ENXIO); 358 if (rhwdep)
359 *rhwdep = NULL;
359 hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL); 360 hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
360 if (hwdep == NULL) { 361 if (hwdep == NULL) {
361 snd_printk(KERN_ERR "hwdep: cannot allocate\n"); 362 snd_printk(KERN_ERR "hwdep: cannot allocate\n");
@@ -374,13 +375,15 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
374 } 375 }
375 init_waitqueue_head(&hwdep->open_wait); 376 init_waitqueue_head(&hwdep->open_wait);
376 mutex_init(&hwdep->open_mutex); 377 mutex_init(&hwdep->open_mutex);
377 *rhwdep = hwdep; 378 if (rhwdep)
379 *rhwdep = hwdep;
378 return 0; 380 return 0;
379} 381}
380 382
381static int snd_hwdep_free(struct snd_hwdep *hwdep) 383static int snd_hwdep_free(struct snd_hwdep *hwdep)
382{ 384{
383 snd_assert(hwdep != NULL, return -ENXIO); 385 if (!hwdep)
386 return 0;
384 if (hwdep->private_free) 387 if (hwdep->private_free)
385 hwdep->private_free(hwdep); 388 hwdep->private_free(hwdep);
386 kfree(hwdep); 389 kfree(hwdep);
@@ -440,7 +443,8 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device)
440{ 443{
441 struct snd_hwdep *hwdep = device->device_data; 444 struct snd_hwdep *hwdep = device->device_data;
442 445
443 snd_assert(hwdep != NULL, return -ENXIO); 446 if (snd_BUG_ON(!hwdep))
447 return -ENXIO;
444 mutex_lock(&register_mutex); 448 mutex_lock(&register_mutex);
445 if (snd_hwdep_search(hwdep->card, hwdep->device) != hwdep) { 449 if (snd_hwdep_search(hwdep->card, hwdep->device) != hwdep) {
446 mutex_unlock(&register_mutex); 450 mutex_unlock(&register_mutex);