]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/core/hwdep.c
ALSA: Kill snd_assert() in sound/core/*
[linux-2.6-omap-h63xx.git] / sound / core / hwdep.c
index 96ffdf18c3fef89e7aa6e39d303a6a678df932ba..195cafc5a55342df53e01a4ecb361a37db178dbd 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Hardware dependent layer
- *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  *
  *
  *   This program is free software; you can redistribute it and/or modify
  *
  */
 
-#include <sound/driver.h>
 #include <linux/major.h>
 #include <linux/init.h>
-#include <linux/smp_lock.h>
 #include <linux/slab.h>
 #include <linux/time.h>
 #include <linux/mutex.h>
@@ -32,7 +30,7 @@
 #include <sound/hwdep.h>
 #include <sound/info.h>
 
-MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
+MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
 MODULE_DESCRIPTION("Hardware dependent layer");
 MODULE_LICENSE("GPL");
 
@@ -355,9 +353,10 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
                .dev_disconnect = snd_hwdep_dev_disconnect,
        };
 
-       snd_assert(rhwdep != NULL, return -EINVAL);
-       *rhwdep = NULL;
-       snd_assert(card != NULL, return -ENXIO);
+       if (snd_BUG_ON(!card))
+               return -ENXIO;
+       if (rhwdep)
+               *rhwdep = NULL;
        hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
        if (hwdep == NULL) {
                snd_printk(KERN_ERR "hwdep: cannot allocate\n");
@@ -376,13 +375,15 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
        }
        init_waitqueue_head(&hwdep->open_wait);
        mutex_init(&hwdep->open_mutex);
-       *rhwdep = hwdep;
+       if (rhwdep)
+               *rhwdep = hwdep;
        return 0;
 }
 
 static int snd_hwdep_free(struct snd_hwdep *hwdep)
 {
-       snd_assert(hwdep != NULL, return -ENXIO);
+       if (!hwdep)
+               return 0;
        if (hwdep->private_free)
                hwdep->private_free(hwdep);
        kfree(hwdep);
@@ -442,7 +443,8 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device)
 {
        struct snd_hwdep *hwdep = device->device_data;
 
-       snd_assert(hwdep != NULL, return -ENXIO);
+       if (snd_BUG_ON(!hwdep))
+               return -ENXIO;
        mutex_lock(&register_mutex);
        if (snd_hwdep_search(hwdep->card, hwdep->device) != hwdep) {
                mutex_unlock(&register_mutex);