aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/rawmidi.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/rawmidi.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/rawmidi.c')
-rw-r--r--sound/core/rawmidi.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index b917a9f981c7..c4995c9f5730 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -470,8 +470,8 @@ int snd_rawmidi_kernel_release(struct snd_rawmidi_file * rfile)
470 struct snd_rawmidi_substream *substream; 470 struct snd_rawmidi_substream *substream;
471 struct snd_rawmidi_runtime *runtime; 471 struct snd_rawmidi_runtime *runtime;
472 472
473 snd_assert(rfile != NULL, return -ENXIO); 473 if (snd_BUG_ON(!rfile))
474 snd_assert(rfile->input != NULL || rfile->output != NULL, return -ENXIO); 474 return -ENXIO;
475 rmidi = rfile->rmidi; 475 rmidi = rfile->rmidi;
476 mutex_lock(&rmidi->open_mutex); 476 mutex_lock(&rmidi->open_mutex);
477 if (rfile->input != NULL) { 477 if (rfile->input != NULL) {
@@ -1100,7 +1100,7 @@ int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count)
1100 return -EINVAL; 1100 return -EINVAL;
1101 } 1101 }
1102 spin_lock_irqsave(&runtime->lock, flags); 1102 spin_lock_irqsave(&runtime->lock, flags);
1103 snd_assert(runtime->avail + count <= runtime->buffer_size, ); 1103 snd_BUG_ON(runtime->avail + count > runtime->buffer_size);
1104 runtime->hw_ptr += count; 1104 runtime->hw_ptr += count;
1105 runtime->hw_ptr %= runtime->buffer_size; 1105 runtime->hw_ptr %= runtime->buffer_size;
1106 runtime->avail += count; 1106 runtime->avail += count;
@@ -1141,8 +1141,10 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,
1141 long count1, result; 1141 long count1, result;
1142 struct snd_rawmidi_runtime *runtime = substream->runtime; 1142 struct snd_rawmidi_runtime *runtime = substream->runtime;
1143 1143
1144 snd_assert(kernelbuf != NULL || userbuf != NULL, return -EINVAL); 1144 if (snd_BUG_ON(!kernelbuf && !userbuf))
1145 snd_assert(runtime->buffer != NULL, return -EINVAL); 1145 return -EINVAL;
1146 if (snd_BUG_ON(!runtime->buffer))
1147 return -EINVAL;
1146 1148
1147 result = 0; 1149 result = 0;
1148 spin_lock_irqsave(&runtime->lock, flags); 1150 spin_lock_irqsave(&runtime->lock, flags);
@@ -1420,9 +1422,10 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
1420 .dev_disconnect = snd_rawmidi_dev_disconnect, 1422 .dev_disconnect = snd_rawmidi_dev_disconnect,
1421 }; 1423 };
1422 1424
1423 snd_assert(rrawmidi != NULL, return -EINVAL); 1425 if (snd_BUG_ON(!card))
1424 *rrawmidi = NULL; 1426 return -ENXIO;
1425 snd_assert(card != NULL, return -ENXIO); 1427 if (rrawmidi)
1428 *rrawmidi = NULL;
1426 rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL); 1429 rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
1427 if (rmidi == NULL) { 1430 if (rmidi == NULL) {
1428 snd_printk(KERN_ERR "rawmidi: cannot allocate\n"); 1431 snd_printk(KERN_ERR "rawmidi: cannot allocate\n");
@@ -1455,7 +1458,8 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
1455 snd_rawmidi_free(rmidi); 1458 snd_rawmidi_free(rmidi);
1456 return err; 1459 return err;
1457 } 1460 }
1458 *rrawmidi = rmidi; 1461 if (rrawmidi)
1462 *rrawmidi = rmidi;
1459 return 0; 1463 return 0;
1460} 1464}
1461 1465
@@ -1472,7 +1476,8 @@ static void snd_rawmidi_free_substreams(struct snd_rawmidi_str *stream)
1472 1476
1473static int snd_rawmidi_free(struct snd_rawmidi *rmidi) 1477static int snd_rawmidi_free(struct snd_rawmidi *rmidi)
1474{ 1478{
1475 snd_assert(rmidi != NULL, return -ENXIO); 1479 if (!rmidi)
1480 return 0;
1476 1481
1477 snd_info_free_entry(rmidi->proc_entry); 1482 snd_info_free_entry(rmidi->proc_entry);
1478 rmidi->proc_entry = NULL; 1483 rmidi->proc_entry = NULL;