aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1/memory.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-08 11:12:14 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-13 05:46:38 -0400
commitda3cec35dd3c31d8706db4bf379372ce70d92118 (patch)
tree9379edebb1c7abc7a7a92ce3be30a35b77d9aa1d /sound/pci/emu10k1/memory.c
parent622207dc31895b4e82c39100db8635d885c795e2 (diff)
ALSA: Kill snd_assert() in sound/pci/*
Kill snd_assert() in sound/pci/*, 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/pci/emu10k1/memory.c')
-rw-r--r--sound/pci/emu10k1/memory.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c
index 7d379f5131fb..e8ad56ed34fa 100644
--- a/sound/pci/emu10k1/memory.c
+++ b/sound/pci/emu10k1/memory.c
@@ -107,7 +107,8 @@ static int search_empty_map_area(struct snd_emu10k1 *emu, int npages, struct lis
107 107
108 list_for_each (pos, &emu->mapped_link_head) { 108 list_for_each (pos, &emu->mapped_link_head) {
109 struct snd_emu10k1_memblk *blk = get_emu10k1_memblk(pos, mapped_link); 109 struct snd_emu10k1_memblk *blk = get_emu10k1_memblk(pos, mapped_link);
110 snd_assert(blk->mapped_page >= 0, continue); 110 if (blk->mapped_page < 0)
111 continue;
111 size = blk->mapped_page - page; 112 size = blk->mapped_page - page;
112 if (size == npages) { 113 if (size == npages) {
113 *nextp = pos; 114 *nextp = pos;
@@ -300,10 +301,14 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
300 struct snd_emu10k1_memblk *blk; 301 struct snd_emu10k1_memblk *blk;
301 int page, err, idx; 302 int page, err, idx;
302 303
303 snd_assert(emu, return NULL); 304 if (snd_BUG_ON(!emu))
304 snd_assert(runtime->dma_bytes > 0 && runtime->dma_bytes < MAXPAGES * EMUPAGESIZE, return NULL); 305 return NULL;
306 if (snd_BUG_ON(runtime->dma_bytes <= 0 ||
307 runtime->dma_bytes >= MAXPAGES * EMUPAGESIZE))
308 return NULL;
305 hdr = emu->memhdr; 309 hdr = emu->memhdr;
306 snd_assert(hdr, return NULL); 310 if (snd_BUG_ON(!hdr))
311 return NULL;
307 312
308 mutex_lock(&hdr->block_mutex); 313 mutex_lock(&hdr->block_mutex);
309 blk = search_empty(emu, runtime->dma_bytes); 314 blk = search_empty(emu, runtime->dma_bytes);
@@ -353,7 +358,8 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
353 */ 358 */
354int snd_emu10k1_free_pages(struct snd_emu10k1 *emu, struct snd_util_memblk *blk) 359int snd_emu10k1_free_pages(struct snd_emu10k1 *emu, struct snd_util_memblk *blk)
355{ 360{
356 snd_assert(emu && blk, return -EINVAL); 361 if (snd_BUG_ON(!emu || !blk))
362 return -EINVAL;
357 return snd_emu10k1_synth_free(emu, blk); 363 return snd_emu10k1_synth_free(emu, blk);
358} 364}
359 365
@@ -498,7 +504,8 @@ static int synth_free_pages(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *
498static inline void *offset_ptr(struct snd_emu10k1 *emu, int page, int offset) 504static inline void *offset_ptr(struct snd_emu10k1 *emu, int page, int offset)
499{ 505{
500 char *ptr; 506 char *ptr;
501 snd_assert(page >= 0 && page < emu->max_cache_pages, return NULL); 507 if (snd_BUG_ON(page < 0 || page >= emu->max_cache_pages))
508 return NULL;
502 ptr = emu->page_ptr_table[page]; 509 ptr = emu->page_ptr_table[page];
503 if (! ptr) { 510 if (! ptr) {
504 printk(KERN_ERR "emu10k1: access to NULL ptr: page = %d\n", page); 511 printk(KERN_ERR "emu10k1: access to NULL ptr: page = %d\n", page);