diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-08-08 11:09:09 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-08-13 05:46:35 -0400 |
commit | 7eaa943c8ed8e91e05d0f5d0dc7a18e3319b45cf (patch) | |
tree | 51d86a4cb01cf5735b18c36ca62471f8c759a041 /sound/core/seq | |
parent | 5ef03460a6ffc1d3ee6b6f2abc6765d3e224cf89 (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/seq')
-rw-r--r-- | sound/core/seq/oss/seq_oss.c | 12 | ||||
-rw-r--r-- | sound/core/seq/oss/seq_oss_synth.c | 6 | ||||
-rw-r--r-- | sound/core/seq/seq_clientmgr.c | 30 | ||||
-rw-r--r-- | sound/core/seq/seq_compat.c | 3 | ||||
-rw-r--r-- | sound/core/seq/seq_device.c | 6 | ||||
-rw-r--r-- | sound/core/seq/seq_fifo.c | 15 | ||||
-rw-r--r-- | sound/core/seq/seq_memory.c | 12 | ||||
-rw-r--r-- | sound/core/seq/seq_midi.c | 15 | ||||
-rw-r--r-- | sound/core/seq/seq_ports.c | 13 | ||||
-rw-r--r-- | sound/core/seq/seq_prioq.c | 4 | ||||
-rw-r--r-- | sound/core/seq/seq_queue.c | 6 | ||||
-rw-r--r-- | sound/core/seq/seq_timer.c | 24 |
12 files changed, 96 insertions, 50 deletions
diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c index 777796e94490..f25e3cc7ddfa 100644 --- a/sound/core/seq/oss/seq_oss.c +++ b/sound/core/seq/oss/seq_oss.c | |||
@@ -164,7 +164,8 @@ odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset) | |||
164 | { | 164 | { |
165 | struct seq_oss_devinfo *dp; | 165 | struct seq_oss_devinfo *dp; |
166 | dp = file->private_data; | 166 | dp = file->private_data; |
167 | snd_assert(dp != NULL, return -EIO); | 167 | if (snd_BUG_ON(!dp)) |
168 | return -ENXIO; | ||
168 | return snd_seq_oss_read(dp, buf, count); | 169 | return snd_seq_oss_read(dp, buf, count); |
169 | } | 170 | } |
170 | 171 | ||
@@ -174,7 +175,8 @@ odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offs | |||
174 | { | 175 | { |
175 | struct seq_oss_devinfo *dp; | 176 | struct seq_oss_devinfo *dp; |
176 | dp = file->private_data; | 177 | dp = file->private_data; |
177 | snd_assert(dp != NULL, return -EIO); | 178 | if (snd_BUG_ON(!dp)) |
179 | return -ENXIO; | ||
178 | return snd_seq_oss_write(dp, buf, count, file); | 180 | return snd_seq_oss_write(dp, buf, count, file); |
179 | } | 181 | } |
180 | 182 | ||
@@ -183,7 +185,8 @@ odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
183 | { | 185 | { |
184 | struct seq_oss_devinfo *dp; | 186 | struct seq_oss_devinfo *dp; |
185 | dp = file->private_data; | 187 | dp = file->private_data; |
186 | snd_assert(dp != NULL, return -EIO); | 188 | if (snd_BUG_ON(!dp)) |
189 | return -ENXIO; | ||
187 | return snd_seq_oss_ioctl(dp, cmd, arg); | 190 | return snd_seq_oss_ioctl(dp, cmd, arg); |
188 | } | 191 | } |
189 | 192 | ||
@@ -198,7 +201,8 @@ odev_poll(struct file *file, poll_table * wait) | |||
198 | { | 201 | { |
199 | struct seq_oss_devinfo *dp; | 202 | struct seq_oss_devinfo *dp; |
200 | dp = file->private_data; | 203 | dp = file->private_data; |
201 | snd_assert(dp != NULL, return 0); | 204 | if (snd_BUG_ON(!dp)) |
205 | return -ENXIO; | ||
202 | return snd_seq_oss_poll(dp, file, wait); | 206 | return snd_seq_oss_poll(dp, file, wait); |
203 | } | 207 | } |
204 | 208 | ||
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c index e024e4588b82..945a27c34a9d 100644 --- a/sound/core/seq/oss/seq_oss_synth.c +++ b/sound/core/seq/oss/seq_oss_synth.c | |||
@@ -308,7 +308,8 @@ snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp) | |||
308 | struct seq_oss_synth *rec; | 308 | struct seq_oss_synth *rec; |
309 | struct seq_oss_synthinfo *info; | 309 | struct seq_oss_synthinfo *info; |
310 | 310 | ||
311 | snd_assert(dp->max_synthdev <= SNDRV_SEQ_OSS_MAX_SYNTH_DEVS, return); | 311 | if (snd_BUG_ON(dp->max_synthdev >= SNDRV_SEQ_OSS_MAX_SYNTH_DEVS)) |
312 | return; | ||
312 | for (i = 0; i < dp->max_synthdev; i++) { | 313 | for (i = 0; i < dp->max_synthdev; i++) { |
313 | info = &dp->synths[i]; | 314 | info = &dp->synths[i]; |
314 | if (! info->opened) | 315 | if (! info->opened) |
@@ -402,7 +403,8 @@ snd_seq_oss_synth_reset(struct seq_oss_devinfo *dp, int dev) | |||
402 | struct seq_oss_synth *rec; | 403 | struct seq_oss_synth *rec; |
403 | struct seq_oss_synthinfo *info; | 404 | struct seq_oss_synthinfo *info; |
404 | 405 | ||
405 | snd_assert(dev >= 0 && dev < dp->max_synthdev, return); | 406 | if (snd_BUG_ON(dev < 0 || dev >= dp->max_synthdev)) |
407 | return; | ||
406 | info = &dp->synths[dev]; | 408 | info = &dp->synths[dev]; |
407 | if (! info->opened) | 409 | if (! info->opened) |
408 | return; | 410 | return; |
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 7a1545d2d953..8ca2be339f3b 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c | |||
@@ -266,7 +266,8 @@ static int seq_free_client1(struct snd_seq_client *client) | |||
266 | { | 266 | { |
267 | unsigned long flags; | 267 | unsigned long flags; |
268 | 268 | ||
269 | snd_assert(client != NULL, return -EINVAL); | 269 | if (!client) |
270 | return 0; | ||
270 | snd_seq_delete_all_ports(client); | 271 | snd_seq_delete_all_ports(client); |
271 | snd_seq_queue_client_leave(client->number); | 272 | snd_seq_queue_client_leave(client->number); |
272 | spin_lock_irqsave(&clients_lock, flags); | 273 | spin_lock_irqsave(&clients_lock, flags); |
@@ -403,7 +404,8 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, | |||
403 | return -EFAULT; | 404 | return -EFAULT; |
404 | 405 | ||
405 | /* check client structures are in place */ | 406 | /* check client structures are in place */ |
406 | snd_assert(client != NULL, return -ENXIO); | 407 | if (snd_BUG_ON(!client)) |
408 | return -ENXIO; | ||
407 | 409 | ||
408 | if (!client->accept_input || (fifo = client->data.user.fifo) == NULL) | 410 | if (!client->accept_input || (fifo = client->data.user.fifo) == NULL) |
409 | return -ENXIO; | 411 | return -ENXIO; |
@@ -825,7 +827,8 @@ int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop) | |||
825 | struct snd_seq_client *client; | 827 | struct snd_seq_client *client; |
826 | int result; | 828 | int result; |
827 | 829 | ||
828 | snd_assert(cell != NULL, return -EINVAL); | 830 | if (snd_BUG_ON(!cell)) |
831 | return -EINVAL; | ||
829 | 832 | ||
830 | client = snd_seq_client_use_ptr(cell->event.source.client); | 833 | client = snd_seq_client_use_ptr(cell->event.source.client); |
831 | if (client == NULL) { | 834 | if (client == NULL) { |
@@ -994,7 +997,8 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, | |||
994 | return -ENXIO; | 997 | return -ENXIO; |
995 | 998 | ||
996 | /* check client structures are in place */ | 999 | /* check client structures are in place */ |
997 | snd_assert(client != NULL, return -ENXIO); | 1000 | if (snd_BUG_ON(!client)) |
1001 | return -ENXIO; | ||
998 | 1002 | ||
999 | if (!client->accept_output || client->pool == NULL) | 1003 | if (!client->accept_output || client->pool == NULL) |
1000 | return -ENXIO; | 1004 | return -ENXIO; |
@@ -1076,7 +1080,8 @@ static unsigned int snd_seq_poll(struct file *file, poll_table * wait) | |||
1076 | unsigned int mask = 0; | 1080 | unsigned int mask = 0; |
1077 | 1081 | ||
1078 | /* check client structures are in place */ | 1082 | /* check client structures are in place */ |
1079 | snd_assert(client != NULL, return -ENXIO); | 1083 | if (snd_BUG_ON(!client)) |
1084 | return -ENXIO; | ||
1080 | 1085 | ||
1081 | if ((snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT) && | 1086 | if ((snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT) && |
1082 | client->data.user.fifo) { | 1087 | client->data.user.fifo) { |
@@ -2195,7 +2200,8 @@ static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
2195 | { | 2200 | { |
2196 | struct snd_seq_client *client = file->private_data; | 2201 | struct snd_seq_client *client = file->private_data; |
2197 | 2202 | ||
2198 | snd_assert(client != NULL, return -ENXIO); | 2203 | if (snd_BUG_ON(!client)) |
2204 | return -ENXIO; | ||
2199 | 2205 | ||
2200 | return snd_seq_do_ioctl(client, cmd, (void __user *) arg); | 2206 | return snd_seq_do_ioctl(client, cmd, (void __user *) arg); |
2201 | } | 2207 | } |
@@ -2216,7 +2222,8 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index, | |||
2216 | struct snd_seq_client *client; | 2222 | struct snd_seq_client *client; |
2217 | va_list args; | 2223 | va_list args; |
2218 | 2224 | ||
2219 | snd_assert(! in_interrupt(), return -EBUSY); | 2225 | if (snd_BUG_ON(in_interrupt())) |
2226 | return -EBUSY; | ||
2220 | 2227 | ||
2221 | if (card && client_index >= SNDRV_SEQ_CLIENTS_PER_CARD) | 2228 | if (card && client_index >= SNDRV_SEQ_CLIENTS_PER_CARD) |
2222 | return -EINVAL; | 2229 | return -EINVAL; |
@@ -2265,7 +2272,8 @@ int snd_seq_delete_kernel_client(int client) | |||
2265 | { | 2272 | { |
2266 | struct snd_seq_client *ptr; | 2273 | struct snd_seq_client *ptr; |
2267 | 2274 | ||
2268 | snd_assert(! in_interrupt(), return -EBUSY); | 2275 | if (snd_BUG_ON(in_interrupt())) |
2276 | return -EBUSY; | ||
2269 | 2277 | ||
2270 | ptr = clientptr(client); | 2278 | ptr = clientptr(client); |
2271 | if (ptr == NULL) | 2279 | if (ptr == NULL) |
@@ -2288,7 +2296,8 @@ static int kernel_client_enqueue(int client, struct snd_seq_event *ev, | |||
2288 | struct snd_seq_client *cptr; | 2296 | struct snd_seq_client *cptr; |
2289 | int result; | 2297 | int result; |
2290 | 2298 | ||
2291 | snd_assert(ev != NULL, return -EINVAL); | 2299 | if (snd_BUG_ON(!ev)) |
2300 | return -EINVAL; | ||
2292 | 2301 | ||
2293 | if (ev->type == SNDRV_SEQ_EVENT_NONE) | 2302 | if (ev->type == SNDRV_SEQ_EVENT_NONE) |
2294 | return 0; /* ignore this */ | 2303 | return 0; /* ignore this */ |
@@ -2354,7 +2363,8 @@ int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event * ev, | |||
2354 | struct snd_seq_client *cptr; | 2363 | struct snd_seq_client *cptr; |
2355 | int result; | 2364 | int result; |
2356 | 2365 | ||
2357 | snd_assert(ev != NULL, return -EINVAL); | 2366 | if (snd_BUG_ON(!ev)) |
2367 | return -EINVAL; | ||
2358 | 2368 | ||
2359 | /* fill in client number */ | 2369 | /* fill in client number */ |
2360 | ev->queue = SNDRV_SEQ_QUEUE_DIRECT; | 2370 | ev->queue = SNDRV_SEQ_QUEUE_DIRECT; |
diff --git a/sound/core/seq/seq_compat.c b/sound/core/seq/seq_compat.c index 9628c06e4eab..38693f47c262 100644 --- a/sound/core/seq/seq_compat.c +++ b/sound/core/seq/seq_compat.c | |||
@@ -92,7 +92,8 @@ static long snd_seq_ioctl_compat(struct file *file, unsigned int cmd, unsigned l | |||
92 | struct snd_seq_client *client = file->private_data; | 92 | struct snd_seq_client *client = file->private_data; |
93 | void __user *argp = compat_ptr(arg); | 93 | void __user *argp = compat_ptr(arg); |
94 | 94 | ||
95 | snd_assert(client != NULL, return -ENXIO); | 95 | if (snd_BUG_ON(!client)) |
96 | return -ENXIO; | ||
96 | 97 | ||
97 | switch (cmd) { | 98 | switch (cmd) { |
98 | case SNDRV_SEQ_IOCTL_PVERSION: | 99 | case SNDRV_SEQ_IOCTL_PVERSION: |
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c index 05410e536a4f..1f997675c893 100644 --- a/sound/core/seq/seq_device.c +++ b/sound/core/seq/seq_device.c | |||
@@ -187,7 +187,8 @@ int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, | |||
187 | if (result) | 187 | if (result) |
188 | *result = NULL; | 188 | *result = NULL; |
189 | 189 | ||
190 | snd_assert(id != NULL, return -EINVAL); | 190 | if (snd_BUG_ON(!id)) |
191 | return -EINVAL; | ||
191 | 192 | ||
192 | ops = find_driver(id, 1); | 193 | ops = find_driver(id, 1); |
193 | if (ops == NULL) | 194 | if (ops == NULL) |
@@ -232,7 +233,8 @@ static int snd_seq_device_free(struct snd_seq_device *dev) | |||
232 | { | 233 | { |
233 | struct ops_list *ops; | 234 | struct ops_list *ops; |
234 | 235 | ||
235 | snd_assert(dev != NULL, return -EINVAL); | 236 | if (snd_BUG_ON(!dev)) |
237 | return -EINVAL; | ||
236 | 238 | ||
237 | ops = find_driver(dev->id, 0); | 239 | ops = find_driver(dev->id, 0); |
238 | if (ops == NULL) | 240 | if (ops == NULL) |
diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c index 3a94ed021bd9..0d75afa786bc 100644 --- a/sound/core/seq/seq_fifo.c +++ b/sound/core/seq/seq_fifo.c | |||
@@ -65,9 +65,11 @@ void snd_seq_fifo_delete(struct snd_seq_fifo **fifo) | |||
65 | { | 65 | { |
66 | struct snd_seq_fifo *f; | 66 | struct snd_seq_fifo *f; |
67 | 67 | ||
68 | snd_assert(fifo != NULL, return); | 68 | if (snd_BUG_ON(!fifo)) |
69 | return; | ||
69 | f = *fifo; | 70 | f = *fifo; |
70 | snd_assert(f != NULL, return); | 71 | if (snd_BUG_ON(!f)) |
72 | return; | ||
71 | *fifo = NULL; | 73 | *fifo = NULL; |
72 | 74 | ||
73 | snd_seq_fifo_clear(f); | 75 | snd_seq_fifo_clear(f); |
@@ -116,7 +118,8 @@ int snd_seq_fifo_event_in(struct snd_seq_fifo *f, | |||
116 | unsigned long flags; | 118 | unsigned long flags; |
117 | int err; | 119 | int err; |
118 | 120 | ||
119 | snd_assert(f != NULL, return -EINVAL); | 121 | if (snd_BUG_ON(!f)) |
122 | return -EINVAL; | ||
120 | 123 | ||
121 | snd_use_lock_use(&f->use_lock); | 124 | snd_use_lock_use(&f->use_lock); |
122 | err = snd_seq_event_dup(f->pool, event, &cell, 1, NULL); /* always non-blocking */ | 125 | err = snd_seq_event_dup(f->pool, event, &cell, 1, NULL); /* always non-blocking */ |
@@ -174,7 +177,8 @@ int snd_seq_fifo_cell_out(struct snd_seq_fifo *f, | |||
174 | unsigned long flags; | 177 | unsigned long flags; |
175 | wait_queue_t wait; | 178 | wait_queue_t wait; |
176 | 179 | ||
177 | snd_assert(f != NULL, return -EINVAL); | 180 | if (snd_BUG_ON(!f)) |
181 | return -EINVAL; | ||
178 | 182 | ||
179 | *cellp = NULL; | 183 | *cellp = NULL; |
180 | init_waitqueue_entry(&wait, current); | 184 | init_waitqueue_entry(&wait, current); |
@@ -233,7 +237,8 @@ int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize) | |||
233 | struct snd_seq_pool *newpool, *oldpool; | 237 | struct snd_seq_pool *newpool, *oldpool; |
234 | struct snd_seq_event_cell *cell, *next, *oldhead; | 238 | struct snd_seq_event_cell *cell, *next, *oldhead; |
235 | 239 | ||
236 | snd_assert(f != NULL && f->pool != NULL, return -EINVAL); | 240 | if (snd_BUG_ON(!f || !f->pool)) |
241 | return -EINVAL; | ||
237 | 242 | ||
238 | /* allocate new pool */ | 243 | /* allocate new pool */ |
239 | newpool = snd_seq_pool_new(poolsize); | 244 | newpool = snd_seq_pool_new(poolsize); |
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index 0cf6ac477318..7fb55436287f 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c | |||
@@ -187,9 +187,11 @@ void snd_seq_cell_free(struct snd_seq_event_cell * cell) | |||
187 | unsigned long flags; | 187 | unsigned long flags; |
188 | struct snd_seq_pool *pool; | 188 | struct snd_seq_pool *pool; |
189 | 189 | ||
190 | snd_assert(cell != NULL, return); | 190 | if (snd_BUG_ON(!cell)) |
191 | return; | ||
191 | pool = cell->pool; | 192 | pool = cell->pool; |
192 | snd_assert(pool != NULL, return); | 193 | if (snd_BUG_ON(!pool)) |
194 | return; | ||
193 | 195 | ||
194 | spin_lock_irqsave(&pool->lock, flags); | 196 | spin_lock_irqsave(&pool->lock, flags); |
195 | free_cell(pool, cell); | 197 | free_cell(pool, cell); |
@@ -378,7 +380,8 @@ int snd_seq_pool_init(struct snd_seq_pool *pool) | |||
378 | struct snd_seq_event_cell *cellptr; | 380 | struct snd_seq_event_cell *cellptr; |
379 | unsigned long flags; | 381 | unsigned long flags; |
380 | 382 | ||
381 | snd_assert(pool != NULL, return -EINVAL); | 383 | if (snd_BUG_ON(!pool)) |
384 | return -EINVAL; | ||
382 | if (pool->ptr) /* should be atomic? */ | 385 | if (pool->ptr) /* should be atomic? */ |
383 | return 0; | 386 | return 0; |
384 | 387 | ||
@@ -414,7 +417,8 @@ int snd_seq_pool_done(struct snd_seq_pool *pool) | |||
414 | struct snd_seq_event_cell *ptr; | 417 | struct snd_seq_event_cell *ptr; |
415 | int max_count = 5 * HZ; | 418 | int max_count = 5 * HZ; |
416 | 419 | ||
417 | snd_assert(pool != NULL, return -EINVAL); | 420 | if (snd_BUG_ON(!pool)) |
421 | return -EINVAL; | ||
418 | 422 | ||
419 | /* wait for closing all threads */ | 423 | /* wait for closing all threads */ |
420 | spin_lock_irqsave(&pool->lock, flags); | 424 | spin_lock_irqsave(&pool->lock, flags); |
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index 99b35360c506..4d26146a62cc 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c | |||
@@ -116,7 +116,8 @@ static int dump_midi(struct snd_rawmidi_substream *substream, const char *buf, i | |||
116 | struct snd_rawmidi_runtime *runtime; | 116 | struct snd_rawmidi_runtime *runtime; |
117 | int tmp; | 117 | int tmp; |
118 | 118 | ||
119 | snd_assert(substream != NULL || buf != NULL, return -EINVAL); | 119 | if (snd_BUG_ON(!substream || !buf)) |
120 | return -EINVAL; | ||
120 | runtime = substream->runtime; | 121 | runtime = substream->runtime; |
121 | if ((tmp = runtime->avail) < count) { | 122 | if ((tmp = runtime->avail) < count) { |
122 | snd_printd("warning, output event was lost (count = %i, available = %i)\n", count, tmp); | 123 | snd_printd("warning, output event was lost (count = %i, available = %i)\n", count, tmp); |
@@ -135,7 +136,8 @@ static int event_process_midi(struct snd_seq_event *ev, int direct, | |||
135 | struct snd_rawmidi_substream *substream; | 136 | struct snd_rawmidi_substream *substream; |
136 | int len; | 137 | int len; |
137 | 138 | ||
138 | snd_assert(msynth != NULL, return -EINVAL); | 139 | if (snd_BUG_ON(!msynth)) |
140 | return -EINVAL; | ||
139 | substream = msynth->output_rfile.output; | 141 | substream = msynth->output_rfile.output; |
140 | if (substream == NULL) | 142 | if (substream == NULL) |
141 | return -ENODEV; | 143 | return -ENODEV; |
@@ -210,7 +212,8 @@ static int midisynth_unsubscribe(void *private_data, struct snd_seq_port_subscri | |||
210 | int err; | 212 | int err; |
211 | struct seq_midisynth *msynth = private_data; | 213 | struct seq_midisynth *msynth = private_data; |
212 | 214 | ||
213 | snd_assert(msynth->input_rfile.input != NULL, return -EINVAL); | 215 | if (snd_BUG_ON(!msynth->input_rfile.input)) |
216 | return -EINVAL; | ||
214 | err = snd_rawmidi_kernel_release(&msynth->input_rfile); | 217 | err = snd_rawmidi_kernel_release(&msynth->input_rfile); |
215 | return err; | 218 | return err; |
216 | } | 219 | } |
@@ -247,7 +250,8 @@ static int midisynth_unuse(void *private_data, struct snd_seq_port_subscribe *in | |||
247 | struct seq_midisynth *msynth = private_data; | 250 | struct seq_midisynth *msynth = private_data; |
248 | unsigned char buf = 0xff; /* MIDI reset */ | 251 | unsigned char buf = 0xff; /* MIDI reset */ |
249 | 252 | ||
250 | snd_assert(msynth->output_rfile.output != NULL, return -EINVAL); | 253 | if (snd_BUG_ON(!msynth->output_rfile.output)) |
254 | return -EINVAL; | ||
251 | /* sending single MIDI reset message to shut the device up */ | 255 | /* sending single MIDI reset message to shut the device up */ |
252 | snd_rawmidi_kernel_write(msynth->output_rfile.output, &buf, 1); | 256 | snd_rawmidi_kernel_write(msynth->output_rfile.output, &buf, 1); |
253 | snd_rawmidi_drain_output(msynth->output_rfile.output); | 257 | snd_rawmidi_drain_output(msynth->output_rfile.output); |
@@ -285,7 +289,8 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev) | |||
285 | int device = dev->device; | 289 | int device = dev->device; |
286 | unsigned int input_count = 0, output_count = 0; | 290 | unsigned int input_count = 0, output_count = 0; |
287 | 291 | ||
288 | snd_assert(card != NULL && device >= 0 && device < SNDRV_RAWMIDI_DEVICES, return -EINVAL); | 292 | if (snd_BUG_ON(!card || device < 0 || device >= SNDRV_RAWMIDI_DEVICES)) |
293 | return -EINVAL; | ||
289 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 294 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
290 | if (! info) | 295 | if (! info) |
291 | return -ENOMEM; | 296 | return -ENOMEM; |
diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c index 1c32a53d6bd8..3bf7d73ac52e 100644 --- a/sound/core/seq/seq_ports.c +++ b/sound/core/seq/seq_ports.c | |||
@@ -130,7 +130,8 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client, | |||
130 | int num = -1; | 130 | int num = -1; |
131 | 131 | ||
132 | /* sanity check */ | 132 | /* sanity check */ |
133 | snd_assert(client, return NULL); | 133 | if (snd_BUG_ON(!client)) |
134 | return NULL; | ||
134 | 135 | ||
135 | if (client->num_ports >= SNDRV_SEQ_MAX_PORTS - 1) { | 136 | if (client->num_ports >= SNDRV_SEQ_MAX_PORTS - 1) { |
136 | snd_printk(KERN_WARNING "too many ports for client %d\n", client->number); | 137 | snd_printk(KERN_WARNING "too many ports for client %d\n", client->number); |
@@ -268,8 +269,8 @@ static int port_delete(struct snd_seq_client *client, | |||
268 | if (port->private_free) | 269 | if (port->private_free) |
269 | port->private_free(port->private_data); | 270 | port->private_free(port->private_data); |
270 | 271 | ||
271 | snd_assert(port->c_src.count == 0,); | 272 | snd_BUG_ON(port->c_src.count != 0); |
272 | snd_assert(port->c_dest.count == 0,); | 273 | snd_BUG_ON(port->c_dest.count != 0); |
273 | 274 | ||
274 | kfree(port); | 275 | kfree(port); |
275 | return 0; | 276 | return 0; |
@@ -336,7 +337,8 @@ int snd_seq_delete_all_ports(struct snd_seq_client *client) | |||
336 | int snd_seq_set_port_info(struct snd_seq_client_port * port, | 337 | int snd_seq_set_port_info(struct snd_seq_client_port * port, |
337 | struct snd_seq_port_info * info) | 338 | struct snd_seq_port_info * info) |
338 | { | 339 | { |
339 | snd_assert(port && info, return -EINVAL); | 340 | if (snd_BUG_ON(!port || !info)) |
341 | return -EINVAL; | ||
340 | 342 | ||
341 | /* set port name */ | 343 | /* set port name */ |
342 | if (info->name[0]) | 344 | if (info->name[0]) |
@@ -365,7 +367,8 @@ int snd_seq_set_port_info(struct snd_seq_client_port * port, | |||
365 | int snd_seq_get_port_info(struct snd_seq_client_port * port, | 367 | int snd_seq_get_port_info(struct snd_seq_client_port * port, |
366 | struct snd_seq_port_info * info) | 368 | struct snd_seq_port_info * info) |
367 | { | 369 | { |
368 | snd_assert(port && info, return -EINVAL); | 370 | if (snd_BUG_ON(!port || !info)) |
371 | return -EINVAL; | ||
369 | 372 | ||
370 | /* get port name */ | 373 | /* get port name */ |
371 | strlcpy(info->name, port->name, sizeof(info->name)); | 374 | strlcpy(info->name, port->name, sizeof(info->name)); |
diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c index 85969db576c9..0101a8b99b73 100644 --- a/sound/core/seq/seq_prioq.c +++ b/sound/core/seq/seq_prioq.c | |||
@@ -153,8 +153,8 @@ int snd_seq_prioq_cell_in(struct snd_seq_prioq * f, | |||
153 | int count; | 153 | int count; |
154 | int prior; | 154 | int prior; |
155 | 155 | ||
156 | snd_assert(f, return -EINVAL); | 156 | if (snd_BUG_ON(!f || !cell)) |
157 | snd_assert(cell, return -EINVAL); | 157 | return -EINVAL; |
158 | 158 | ||
159 | /* check flags */ | 159 | /* check flags */ |
160 | prior = (cell->event.flags & SNDRV_SEQ_PRIORITY_MASK); | 160 | prior = (cell->event.flags & SNDRV_SEQ_PRIORITY_MASK); |
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c index 4a48c6ee8ee8..e7a8e9e4edb2 100644 --- a/sound/core/seq/seq_queue.c +++ b/sound/core/seq/seq_queue.c | |||
@@ -315,7 +315,8 @@ int snd_seq_enqueue_event(struct snd_seq_event_cell *cell, int atomic, int hop) | |||
315 | int dest, err; | 315 | int dest, err; |
316 | struct snd_seq_queue *q; | 316 | struct snd_seq_queue *q; |
317 | 317 | ||
318 | snd_assert(cell != NULL, return -EINVAL); | 318 | if (snd_BUG_ON(!cell)) |
319 | return -EINVAL; | ||
319 | dest = cell->event.queue; /* destination queue */ | 320 | dest = cell->event.queue; /* destination queue */ |
320 | q = queueptr(dest); | 321 | q = queueptr(dest); |
321 | if (q == NULL) | 322 | if (q == NULL) |
@@ -734,7 +735,8 @@ int snd_seq_control_queue(struct snd_seq_event *ev, int atomic, int hop) | |||
734 | { | 735 | { |
735 | struct snd_seq_queue *q; | 736 | struct snd_seq_queue *q; |
736 | 737 | ||
737 | snd_assert(ev != NULL, return -EINVAL); | 738 | if (snd_BUG_ON(!ev)) |
739 | return -EINVAL; | ||
738 | q = queueptr(ev->data.queue.queue); | 740 | q = queueptr(ev->data.queue.queue); |
739 | 741 | ||
740 | if (q == NULL) | 742 | if (q == NULL) |
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index d8fcd62e400f..f745c317d6af 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c | |||
@@ -173,7 +173,8 @@ int snd_seq_timer_set_tempo(struct snd_seq_timer * tmr, int tempo) | |||
173 | { | 173 | { |
174 | unsigned long flags; | 174 | unsigned long flags; |
175 | 175 | ||
176 | snd_assert(tmr, return -EINVAL); | 176 | if (snd_BUG_ON(!tmr)) |
177 | return -EINVAL; | ||
177 | if (tempo <= 0) | 178 | if (tempo <= 0) |
178 | return -EINVAL; | 179 | return -EINVAL; |
179 | spin_lock_irqsave(&tmr->lock, flags); | 180 | spin_lock_irqsave(&tmr->lock, flags); |
@@ -190,7 +191,8 @@ int snd_seq_timer_set_ppq(struct snd_seq_timer * tmr, int ppq) | |||
190 | { | 191 | { |
191 | unsigned long flags; | 192 | unsigned long flags; |
192 | 193 | ||
193 | snd_assert(tmr, return -EINVAL); | 194 | if (snd_BUG_ON(!tmr)) |
195 | return -EINVAL; | ||
194 | if (ppq <= 0) | 196 | if (ppq <= 0) |
195 | return -EINVAL; | 197 | return -EINVAL; |
196 | spin_lock_irqsave(&tmr->lock, flags); | 198 | spin_lock_irqsave(&tmr->lock, flags); |
@@ -214,7 +216,8 @@ int snd_seq_timer_set_position_tick(struct snd_seq_timer *tmr, | |||
214 | { | 216 | { |
215 | unsigned long flags; | 217 | unsigned long flags; |
216 | 218 | ||
217 | snd_assert(tmr, return -EINVAL); | 219 | if (snd_BUG_ON(!tmr)) |
220 | return -EINVAL; | ||
218 | 221 | ||
219 | spin_lock_irqsave(&tmr->lock, flags); | 222 | spin_lock_irqsave(&tmr->lock, flags); |
220 | tmr->tick.cur_tick = position; | 223 | tmr->tick.cur_tick = position; |
@@ -229,7 +232,8 @@ int snd_seq_timer_set_position_time(struct snd_seq_timer *tmr, | |||
229 | { | 232 | { |
230 | unsigned long flags; | 233 | unsigned long flags; |
231 | 234 | ||
232 | snd_assert(tmr, return -EINVAL); | 235 | if (snd_BUG_ON(!tmr)) |
236 | return -EINVAL; | ||
233 | 237 | ||
234 | snd_seq_sanity_real_time(&position); | 238 | snd_seq_sanity_real_time(&position); |
235 | spin_lock_irqsave(&tmr->lock, flags); | 239 | spin_lock_irqsave(&tmr->lock, flags); |
@@ -244,7 +248,8 @@ int snd_seq_timer_set_skew(struct snd_seq_timer *tmr, unsigned int skew, | |||
244 | { | 248 | { |
245 | unsigned long flags; | 249 | unsigned long flags; |
246 | 250 | ||
247 | snd_assert(tmr, return -EINVAL); | 251 | if (snd_BUG_ON(!tmr)) |
252 | return -EINVAL; | ||
248 | 253 | ||
249 | /* FIXME */ | 254 | /* FIXME */ |
250 | if (base != SKEW_BASE) { | 255 | if (base != SKEW_BASE) { |
@@ -265,7 +270,8 @@ int snd_seq_timer_open(struct snd_seq_queue *q) | |||
265 | int err; | 270 | int err; |
266 | 271 | ||
267 | tmr = q->timer; | 272 | tmr = q->timer; |
268 | snd_assert(tmr != NULL, return -EINVAL); | 273 | if (snd_BUG_ON(!tmr)) |
274 | return -EINVAL; | ||
269 | if (tmr->timeri) | 275 | if (tmr->timeri) |
270 | return -EBUSY; | 276 | return -EBUSY; |
271 | sprintf(str, "sequencer queue %i", q->queue); | 277 | sprintf(str, "sequencer queue %i", q->queue); |
@@ -302,7 +308,8 @@ int snd_seq_timer_close(struct snd_seq_queue *q) | |||
302 | struct snd_seq_timer *tmr; | 308 | struct snd_seq_timer *tmr; |
303 | 309 | ||
304 | tmr = q->timer; | 310 | tmr = q->timer; |
305 | snd_assert(tmr != NULL, return -EINVAL); | 311 | if (snd_BUG_ON(!tmr)) |
312 | return -EINVAL; | ||
306 | if (tmr->timeri) { | 313 | if (tmr->timeri) { |
307 | snd_timer_stop(tmr->timeri); | 314 | snd_timer_stop(tmr->timeri); |
308 | snd_timer_close(tmr->timeri); | 315 | snd_timer_close(tmr->timeri); |
@@ -328,7 +335,8 @@ static int initialize_timer(struct snd_seq_timer *tmr) | |||
328 | unsigned long freq; | 335 | unsigned long freq; |
329 | 336 | ||
330 | t = tmr->timeri->timer; | 337 | t = tmr->timeri->timer; |
331 | snd_assert(t, return -EINVAL); | 338 | if (snd_BUG_ON(!t)) |
339 | return -EINVAL; | ||
332 | 340 | ||
333 | freq = tmr->preferred_resolution; | 341 | freq = tmr->preferred_resolution; |
334 | if (!freq) | 342 | if (!freq) |