diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-08-08 11:12:14 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-08-13 05:46:38 -0400 |
commit | da3cec35dd3c31d8706db4bf379372ce70d92118 (patch) | |
tree | 9379edebb1c7abc7a7a92ce3be30a35b77d9aa1d /sound/pci/emu10k1 | |
parent | 622207dc31895b4e82c39100db8635d885c795e2 (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')
-rw-r--r-- | sound/pci/emu10k1/emu10k1_callback.c | 6 | ||||
-rw-r--r-- | sound/pci/emu10k1/emu10k1_patch.c | 23 | ||||
-rw-r--r-- | sound/pci/emu10k1/emu10k1x.c | 18 | ||||
-rw-r--r-- | sound/pci/emu10k1/emufx.c | 6 | ||||
-rw-r--r-- | sound/pci/emu10k1/emumpu401.c | 18 | ||||
-rw-r--r-- | sound/pci/emu10k1/memory.c | 19 | ||||
-rw-r--r-- | sound/pci/emu10k1/voice.c | 9 |
7 files changed, 65 insertions, 34 deletions
diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c index 45088ebcce50..0e649dcdbf64 100644 --- a/sound/pci/emu10k1/emu10k1_callback.c +++ b/sound/pci/emu10k1/emu10k1_callback.c | |||
@@ -145,7 +145,8 @@ terminate_voice(struct snd_emux_voice *vp) | |||
145 | { | 145 | { |
146 | struct snd_emu10k1 *hw; | 146 | struct snd_emu10k1 *hw; |
147 | 147 | ||
148 | snd_assert(vp, return); | 148 | if (snd_BUG_ON(!vp)) |
149 | return; | ||
149 | hw = vp->hw; | 150 | hw = vp->hw; |
150 | snd_emu10k1_ptr_write(hw, DCYSUSV, vp->ch, 0x807f | DCYSUSV_CHANNELENABLE_MASK); | 151 | snd_emu10k1_ptr_write(hw, DCYSUSV, vp->ch, 0x807f | DCYSUSV_CHANNELENABLE_MASK); |
151 | if (vp->block) { | 152 | if (vp->block) { |
@@ -325,7 +326,8 @@ start_voice(struct snd_emux_voice *vp) | |||
325 | 326 | ||
326 | hw = vp->hw; | 327 | hw = vp->hw; |
327 | ch = vp->ch; | 328 | ch = vp->ch; |
328 | snd_assert(ch >= 0, return -EINVAL); | 329 | if (snd_BUG_ON(ch < 0)) |
330 | return -EINVAL; | ||
329 | chan = vp->chan; | 331 | chan = vp->chan; |
330 | 332 | ||
331 | emem = (struct snd_emu10k1_memblk *)vp->block; | 333 | emem = (struct snd_emu10k1_memblk *)vp->block; |
diff --git a/sound/pci/emu10k1/emu10k1_patch.c b/sound/pci/emu10k1/emu10k1_patch.c index 42bae6f7e9a4..e10f027bde03 100644 --- a/sound/pci/emu10k1/emu10k1_patch.c +++ b/sound/pci/emu10k1/emu10k1_patch.c | |||
@@ -46,8 +46,8 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, | |||
46 | struct snd_emu10k1 *emu; | 46 | struct snd_emu10k1 *emu; |
47 | 47 | ||
48 | emu = rec->hw; | 48 | emu = rec->hw; |
49 | snd_assert(sp != NULL, return -EINVAL); | 49 | if (snd_BUG_ON(!sp || !hdr)) |
50 | snd_assert(hdr != NULL, return -EINVAL); | 50 | return -EINVAL; |
51 | 51 | ||
52 | if (sp->v.size == 0) { | 52 | if (sp->v.size == 0) { |
53 | snd_printd("emu: rom font for sample %d\n", sp->v.sample); | 53 | snd_printd("emu: rom font for sample %d\n", sp->v.sample); |
@@ -104,7 +104,8 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, | |||
104 | size = BLANK_HEAD_SIZE; | 104 | size = BLANK_HEAD_SIZE; |
105 | if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) | 105 | if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) |
106 | size *= 2; | 106 | size *= 2; |
107 | snd_assert(offset + size <= blocksize, return -EINVAL); | 107 | if (offset + size > blocksize) |
108 | return -EINVAL; | ||
108 | snd_emu10k1_synth_bzero(emu, sp->block, offset, size); | 109 | snd_emu10k1_synth_bzero(emu, sp->block, offset, size); |
109 | offset += size; | 110 | offset += size; |
110 | 111 | ||
@@ -112,7 +113,8 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, | |||
112 | size = loopend; | 113 | size = loopend; |
113 | if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) | 114 | if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) |
114 | size *= 2; | 115 | size *= 2; |
115 | snd_assert(offset + size <= blocksize, return -EINVAL); | 116 | if (offset + size > blocksize) |
117 | return -EINVAL; | ||
116 | if (snd_emu10k1_synth_copy_from_user(emu, sp->block, offset, data, size)) { | 118 | if (snd_emu10k1_synth_copy_from_user(emu, sp->block, offset, data, size)) { |
117 | snd_emu10k1_synth_free(emu, sp->block); | 119 | snd_emu10k1_synth_free(emu, sp->block); |
118 | sp->block = NULL; | 120 | sp->block = NULL; |
@@ -129,12 +131,14 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, | |||
129 | int woffset; | 131 | int woffset; |
130 | unsigned short *wblock = (unsigned short*)block; | 132 | unsigned short *wblock = (unsigned short*)block; |
131 | woffset = offset / 2; | 133 | woffset = offset / 2; |
132 | snd_assert(offset + loopsize*2 <= blocksize, return -EINVAL); | 134 | if (offset + loopsize * 2 > blocksize) |
135 | return -EINVAL; | ||
133 | for (i = 0; i < loopsize; i++) | 136 | for (i = 0; i < loopsize; i++) |
134 | wblock[woffset + i] = wblock[woffset - i -1]; | 137 | wblock[woffset + i] = wblock[woffset - i -1]; |
135 | offset += loopsize * 2; | 138 | offset += loopsize * 2; |
136 | } else { | 139 | } else { |
137 | snd_assert(offset + loopsize <= blocksize, return -EINVAL); | 140 | if (offset + loopsize > blocksize) |
141 | return -EINVAL; | ||
138 | for (i = 0; i < loopsize; i++) | 142 | for (i = 0; i < loopsize; i++) |
139 | block[offset + i] = block[offset - i -1]; | 143 | block[offset + i] = block[offset - i -1]; |
140 | offset += loopsize; | 144 | offset += loopsize; |
@@ -154,7 +158,8 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, | |||
154 | 158 | ||
155 | /* loopend -> sample end */ | 159 | /* loopend -> sample end */ |
156 | size = sp->v.size - loopend; | 160 | size = sp->v.size - loopend; |
157 | snd_assert(size >= 0, return -EINVAL); | 161 | if (size < 0) |
162 | return -EINVAL; | ||
158 | if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) | 163 | if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) |
159 | size *= 2; | 164 | size *= 2; |
160 | if (snd_emu10k1_synth_copy_from_user(emu, sp->block, offset, data, size)) { | 165 | if (snd_emu10k1_synth_copy_from_user(emu, sp->block, offset, data, size)) { |
@@ -212,8 +217,8 @@ snd_emu10k1_sample_free(struct snd_emux *rec, struct snd_sf_sample *sp, | |||
212 | struct snd_emu10k1 *emu; | 217 | struct snd_emu10k1 *emu; |
213 | 218 | ||
214 | emu = rec->hw; | 219 | emu = rec->hw; |
215 | snd_assert(sp != NULL, return -EINVAL); | 220 | if (snd_BUG_ON(!sp || !hdr)) |
216 | snd_assert(hdr != NULL, return -EINVAL); | 221 | return -EINVAL; |
217 | 222 | ||
218 | if (sp->block) { | 223 | if (sp->block) { |
219 | snd_emu10k1_synth_free(emu, sp->block); | 224 | snd_emu10k1_synth_free(emu, sp->block); |
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 491a4a50f869..5ff4dbb62dad 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -1319,7 +1319,8 @@ static int snd_emu10k1x_midi_input_open(struct snd_rawmidi_substream *substream) | |||
1319 | unsigned long flags; | 1319 | unsigned long flags; |
1320 | 1320 | ||
1321 | emu = midi->emu; | 1321 | emu = midi->emu; |
1322 | snd_assert(emu, return -ENXIO); | 1322 | if (snd_BUG_ON(!emu)) |
1323 | return -ENXIO; | ||
1323 | spin_lock_irqsave(&midi->open_lock, flags); | 1324 | spin_lock_irqsave(&midi->open_lock, flags); |
1324 | midi->midi_mode |= EMU10K1X_MIDI_MODE_INPUT; | 1325 | midi->midi_mode |= EMU10K1X_MIDI_MODE_INPUT; |
1325 | midi->substream_input = substream; | 1326 | midi->substream_input = substream; |
@@ -1345,7 +1346,8 @@ static int snd_emu10k1x_midi_output_open(struct snd_rawmidi_substream *substream | |||
1345 | unsigned long flags; | 1346 | unsigned long flags; |
1346 | 1347 | ||
1347 | emu = midi->emu; | 1348 | emu = midi->emu; |
1348 | snd_assert(emu, return -ENXIO); | 1349 | if (snd_BUG_ON(!emu)) |
1350 | return -ENXIO; | ||
1349 | spin_lock_irqsave(&midi->open_lock, flags); | 1351 | spin_lock_irqsave(&midi->open_lock, flags); |
1350 | midi->midi_mode |= EMU10K1X_MIDI_MODE_OUTPUT; | 1352 | midi->midi_mode |= EMU10K1X_MIDI_MODE_OUTPUT; |
1351 | midi->substream_output = substream; | 1353 | midi->substream_output = substream; |
@@ -1372,7 +1374,8 @@ static int snd_emu10k1x_midi_input_close(struct snd_rawmidi_substream *substream | |||
1372 | int err = 0; | 1374 | int err = 0; |
1373 | 1375 | ||
1374 | emu = midi->emu; | 1376 | emu = midi->emu; |
1375 | snd_assert(emu, return -ENXIO); | 1377 | if (snd_BUG_ON(!emu)) |
1378 | return -ENXIO; | ||
1376 | spin_lock_irqsave(&midi->open_lock, flags); | 1379 | spin_lock_irqsave(&midi->open_lock, flags); |
1377 | snd_emu10k1x_intr_disable(emu, midi->rx_enable); | 1380 | snd_emu10k1x_intr_disable(emu, midi->rx_enable); |
1378 | midi->midi_mode &= ~EMU10K1X_MIDI_MODE_INPUT; | 1381 | midi->midi_mode &= ~EMU10K1X_MIDI_MODE_INPUT; |
@@ -1394,7 +1397,8 @@ static int snd_emu10k1x_midi_output_close(struct snd_rawmidi_substream *substrea | |||
1394 | int err = 0; | 1397 | int err = 0; |
1395 | 1398 | ||
1396 | emu = midi->emu; | 1399 | emu = midi->emu; |
1397 | snd_assert(emu, return -ENXIO); | 1400 | if (snd_BUG_ON(!emu)) |
1401 | return -ENXIO; | ||
1398 | spin_lock_irqsave(&midi->open_lock, flags); | 1402 | spin_lock_irqsave(&midi->open_lock, flags); |
1399 | snd_emu10k1x_intr_disable(emu, midi->tx_enable); | 1403 | snd_emu10k1x_intr_disable(emu, midi->tx_enable); |
1400 | midi->midi_mode &= ~EMU10K1X_MIDI_MODE_OUTPUT; | 1404 | midi->midi_mode &= ~EMU10K1X_MIDI_MODE_OUTPUT; |
@@ -1413,7 +1417,8 @@ static void snd_emu10k1x_midi_input_trigger(struct snd_rawmidi_substream *substr | |||
1413 | struct emu10k1x *emu; | 1417 | struct emu10k1x *emu; |
1414 | struct emu10k1x_midi *midi = substream->rmidi->private_data; | 1418 | struct emu10k1x_midi *midi = substream->rmidi->private_data; |
1415 | emu = midi->emu; | 1419 | emu = midi->emu; |
1416 | snd_assert(emu, return); | 1420 | if (snd_BUG_ON(!emu)) |
1421 | return; | ||
1417 | 1422 | ||
1418 | if (up) | 1423 | if (up) |
1419 | snd_emu10k1x_intr_enable(emu, midi->rx_enable); | 1424 | snd_emu10k1x_intr_enable(emu, midi->rx_enable); |
@@ -1428,7 +1433,8 @@ static void snd_emu10k1x_midi_output_trigger(struct snd_rawmidi_substream *subst | |||
1428 | unsigned long flags; | 1433 | unsigned long flags; |
1429 | 1434 | ||
1430 | emu = midi->emu; | 1435 | emu = midi->emu; |
1431 | snd_assert(emu, return); | 1436 | if (snd_BUG_ON(!emu)) |
1437 | return; | ||
1432 | 1438 | ||
1433 | if (up) { | 1439 | if (up) { |
1434 | int max = 4; | 1440 | int max = 4; |
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 71dc4c8865b8..7dba08f0ab8e 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c | |||
@@ -487,7 +487,8 @@ static void snd_emu10k1_write_op(struct snd_emu10k1_fx8010_code *icode, | |||
487 | u32 op, u32 r, u32 a, u32 x, u32 y) | 487 | u32 op, u32 r, u32 a, u32 x, u32 y) |
488 | { | 488 | { |
489 | u_int32_t *code; | 489 | u_int32_t *code; |
490 | snd_assert(*ptr < 512, return); | 490 | if (snd_BUG_ON(*ptr >= 512)) |
491 | return; | ||
491 | code = (u_int32_t __force *)icode->code + (*ptr) * 2; | 492 | code = (u_int32_t __force *)icode->code + (*ptr) * 2; |
492 | set_bit(*ptr, icode->code_valid); | 493 | set_bit(*ptr, icode->code_valid); |
493 | code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff); | 494 | code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff); |
@@ -503,7 +504,8 @@ static void snd_emu10k1_audigy_write_op(struct snd_emu10k1_fx8010_code *icode, | |||
503 | u32 op, u32 r, u32 a, u32 x, u32 y) | 504 | u32 op, u32 r, u32 a, u32 x, u32 y) |
504 | { | 505 | { |
505 | u_int32_t *code; | 506 | u_int32_t *code; |
506 | snd_assert(*ptr < 1024, return); | 507 | if (snd_BUG_ON(*ptr >= 1024)) |
508 | return; | ||
507 | code = (u_int32_t __force *)icode->code + (*ptr) * 2; | 509 | code = (u_int32_t __force *)icode->code + (*ptr) * 2; |
508 | set_bit(*ptr, icode->code_valid); | 510 | set_bit(*ptr, icode->code_valid); |
509 | code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff); | 511 | code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff); |
diff --git a/sound/pci/emu10k1/emumpu401.c b/sound/pci/emu10k1/emumpu401.c index c4d76d16661e..8578c70c61f2 100644 --- a/sound/pci/emu10k1/emumpu401.c +++ b/sound/pci/emu10k1/emumpu401.c | |||
@@ -157,7 +157,8 @@ static int snd_emu10k1_midi_input_open(struct snd_rawmidi_substream *substream) | |||
157 | unsigned long flags; | 157 | unsigned long flags; |
158 | 158 | ||
159 | emu = midi->emu; | 159 | emu = midi->emu; |
160 | snd_assert(emu, return -ENXIO); | 160 | if (snd_BUG_ON(!emu)) |
161 | return -ENXIO; | ||
161 | spin_lock_irqsave(&midi->open_lock, flags); | 162 | spin_lock_irqsave(&midi->open_lock, flags); |
162 | midi->midi_mode |= EMU10K1_MIDI_MODE_INPUT; | 163 | midi->midi_mode |= EMU10K1_MIDI_MODE_INPUT; |
163 | midi->substream_input = substream; | 164 | midi->substream_input = substream; |
@@ -183,7 +184,8 @@ static int snd_emu10k1_midi_output_open(struct snd_rawmidi_substream *substream) | |||
183 | unsigned long flags; | 184 | unsigned long flags; |
184 | 185 | ||
185 | emu = midi->emu; | 186 | emu = midi->emu; |
186 | snd_assert(emu, return -ENXIO); | 187 | if (snd_BUG_ON(!emu)) |
188 | return -ENXIO; | ||
187 | spin_lock_irqsave(&midi->open_lock, flags); | 189 | spin_lock_irqsave(&midi->open_lock, flags); |
188 | midi->midi_mode |= EMU10K1_MIDI_MODE_OUTPUT; | 190 | midi->midi_mode |= EMU10K1_MIDI_MODE_OUTPUT; |
189 | midi->substream_output = substream; | 191 | midi->substream_output = substream; |
@@ -210,7 +212,8 @@ static int snd_emu10k1_midi_input_close(struct snd_rawmidi_substream *substream) | |||
210 | int err = 0; | 212 | int err = 0; |
211 | 213 | ||
212 | emu = midi->emu; | 214 | emu = midi->emu; |
213 | snd_assert(emu, return -ENXIO); | 215 | if (snd_BUG_ON(!emu)) |
216 | return -ENXIO; | ||
214 | spin_lock_irqsave(&midi->open_lock, flags); | 217 | spin_lock_irqsave(&midi->open_lock, flags); |
215 | snd_emu10k1_intr_disable(emu, midi->rx_enable); | 218 | snd_emu10k1_intr_disable(emu, midi->rx_enable); |
216 | midi->midi_mode &= ~EMU10K1_MIDI_MODE_INPUT; | 219 | midi->midi_mode &= ~EMU10K1_MIDI_MODE_INPUT; |
@@ -232,7 +235,8 @@ static int snd_emu10k1_midi_output_close(struct snd_rawmidi_substream *substream | |||
232 | int err = 0; | 235 | int err = 0; |
233 | 236 | ||
234 | emu = midi->emu; | 237 | emu = midi->emu; |
235 | snd_assert(emu, return -ENXIO); | 238 | if (snd_BUG_ON(!emu)) |
239 | return -ENXIO; | ||
236 | spin_lock_irqsave(&midi->open_lock, flags); | 240 | spin_lock_irqsave(&midi->open_lock, flags); |
237 | snd_emu10k1_intr_disable(emu, midi->tx_enable); | 241 | snd_emu10k1_intr_disable(emu, midi->tx_enable); |
238 | midi->midi_mode &= ~EMU10K1_MIDI_MODE_OUTPUT; | 242 | midi->midi_mode &= ~EMU10K1_MIDI_MODE_OUTPUT; |
@@ -251,7 +255,8 @@ static void snd_emu10k1_midi_input_trigger(struct snd_rawmidi_substream *substre | |||
251 | struct snd_emu10k1 *emu; | 255 | struct snd_emu10k1 *emu; |
252 | struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)substream->rmidi->private_data; | 256 | struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)substream->rmidi->private_data; |
253 | emu = midi->emu; | 257 | emu = midi->emu; |
254 | snd_assert(emu, return); | 258 | if (snd_BUG_ON(!emu)) |
259 | return; | ||
255 | 260 | ||
256 | if (up) | 261 | if (up) |
257 | snd_emu10k1_intr_enable(emu, midi->rx_enable); | 262 | snd_emu10k1_intr_enable(emu, midi->rx_enable); |
@@ -266,7 +271,8 @@ static void snd_emu10k1_midi_output_trigger(struct snd_rawmidi_substream *substr | |||
266 | unsigned long flags; | 271 | unsigned long flags; |
267 | 272 | ||
268 | emu = midi->emu; | 273 | emu = midi->emu; |
269 | snd_assert(emu, return); | 274 | if (snd_BUG_ON(!emu)) |
275 | return; | ||
270 | 276 | ||
271 | if (up) { | 277 | if (up) { |
272 | int max = 4; | 278 | int max = 4; |
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 | */ |
354 | int snd_emu10k1_free_pages(struct snd_emu10k1 *emu, struct snd_util_memblk *blk) | 359 | int 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 * | |||
498 | static inline void *offset_ptr(struct snd_emu10k1 *emu, int page, int offset) | 504 | static 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); |
diff --git a/sound/pci/emu10k1/voice.c b/sound/pci/emu10k1/voice.c index 958cb2a65a4e..d7300a1aa262 100644 --- a/sound/pci/emu10k1/voice.c +++ b/sound/pci/emu10k1/voice.c | |||
@@ -111,8 +111,10 @@ int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int number, | |||
111 | unsigned long flags; | 111 | unsigned long flags; |
112 | int result; | 112 | int result; |
113 | 113 | ||
114 | snd_assert(rvoice != NULL, return -EINVAL); | 114 | if (snd_BUG_ON(!rvoice)) |
115 | snd_assert(number, return -EINVAL); | 115 | return -EINVAL; |
116 | if (snd_BUG_ON(!number)) | ||
117 | return -EINVAL; | ||
116 | 118 | ||
117 | spin_lock_irqsave(&emu->voice_lock, flags); | 119 | spin_lock_irqsave(&emu->voice_lock, flags); |
118 | for (;;) { | 120 | for (;;) { |
@@ -145,7 +147,8 @@ int snd_emu10k1_voice_free(struct snd_emu10k1 *emu, | |||
145 | { | 147 | { |
146 | unsigned long flags; | 148 | unsigned long flags; |
147 | 149 | ||
148 | snd_assert(pvoice != NULL, return -EINVAL); | 150 | if (snd_BUG_ON(!pvoice)) |
151 | return -EINVAL; | ||
149 | spin_lock_irqsave(&emu->voice_lock, flags); | 152 | spin_lock_irqsave(&emu->voice_lock, flags); |
150 | pvoice->interrupt = NULL; | 153 | pvoice->interrupt = NULL; |
151 | pvoice->use = pvoice->pcm = pvoice->synth = pvoice->midi = pvoice->efx = 0; | 154 | pvoice->use = pvoice->pcm = pvoice->synth = pvoice->midi = pvoice->efx = 0; |