]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - sound/synth/util_mem.c
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville...
[karo-tx-linux.git] / sound / synth / util_mem.c
index deabe5f899c494780eb29c188f9fe23edf8c92e8..8e34bc4e07ec3a62d93d9a0d0ca693a77ba9749f 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/mutex.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/module.h>
 #include <sound/core.h>
 #include <sound/util_mem.h>
 
@@ -55,7 +56,8 @@ void snd_util_memhdr_free(struct snd_util_memhdr *hdr)
 {
        struct list_head *p;
 
-       snd_assert(hdr != NULL, return);
+       if (!hdr)
+               return;
        /* release all blocks */
        while ((p = hdr->block.next) != &hdr->block) {
                list_del(p);
@@ -74,8 +76,8 @@ __snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size)
        unsigned int units, prev_offset;
        struct list_head *p;
 
-       snd_assert(hdr != NULL, return NULL);
-       snd_assert(size > 0, return NULL);
+       if (snd_BUG_ON(!hdr || size <= 0))
+               return NULL;
 
        /* word alignment */
        units = size;
@@ -161,7 +163,8 @@ __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk)
  */
 int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk)
 {
-       snd_assert(hdr && blk, return -EINVAL);
+       if (snd_BUG_ON(!hdr || !blk))
+               return -EINVAL;
 
        mutex_lock(&hdr->block_mutex);
        __snd_util_mem_free(hdr, blk);