Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: Kill snd_assert() in other places

Kill snd_assert() in other places, 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>

authored by

Takashi Iwai and committed by
Jaroslav Kysela
5e246b85 da3cec35

+217 -168
+8 -5
drivers/media/video/saa7134/saa7134-alsa.c
··· 488 488 period_size = params_period_bytes(hw_params); 489 489 periods = params_periods(hw_params); 490 490 491 - snd_assert(period_size >= 0x100 && period_size <= 0x10000, 492 - return -EINVAL); 493 - snd_assert(periods >= 4, return -EINVAL); 494 - snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL); 491 + if (period_size < 0x100 || period_size > 0x10000) 492 + return -EINVAL; 493 + if (periods < 4) 494 + return -EINVAL; 495 + if (period_size * periods > 1024 * 1024) 496 + return -EINVAL; 495 497 496 498 dev = saa7134->dev; 497 499 ··· 944 942 unsigned int idx; 945 943 int err; 946 944 947 - snd_assert(chip != NULL, return -EINVAL); 945 + if (snd_BUG_ON(!chip)) 946 + return -EINVAL; 948 947 strcpy(card->mixername, "SAA7134 Mixer"); 949 948 950 949 for (idx = 0; idx < ARRAY_SIZE(snd_saa7134_controls); idx++) {
-9
include/sound/vx_core.h
··· 235 235 */ 236 236 static inline int vx_test_and_ack(struct vx_core *chip) 237 237 { 238 - snd_assert(chip->ops->test_and_ack, return -ENXIO); 239 238 return chip->ops->test_and_ack(chip); 240 239 } 241 240 242 241 static inline void vx_validate_irq(struct vx_core *chip, int enable) 243 242 { 244 - snd_assert(chip->ops->validate_irq, return); 245 243 chip->ops->validate_irq(chip, enable); 246 244 } 247 245 248 246 static inline unsigned char snd_vx_inb(struct vx_core *chip, int reg) 249 247 { 250 - snd_assert(chip->ops->in8, return 0); 251 248 return chip->ops->in8(chip, reg); 252 249 } 253 250 254 251 static inline unsigned int snd_vx_inl(struct vx_core *chip, int reg) 255 252 { 256 - snd_assert(chip->ops->in32, return 0); 257 253 return chip->ops->in32(chip, reg); 258 254 } 259 255 260 256 static inline void snd_vx_outb(struct vx_core *chip, int reg, unsigned char val) 261 257 { 262 - snd_assert(chip->ops->out8, return); 263 258 chip->ops->out8(chip, reg, val); 264 259 } 265 260 266 261 static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val) 267 262 { 268 - snd_assert(chip->ops->out32, return); 269 263 chip->ops->out32(chip, reg, val); 270 264 } 271 265 ··· 270 276 271 277 static inline void vx_reset_dsp(struct vx_core *chip) 272 278 { 273 - snd_assert(chip->ops->reset_dsp, return); 274 279 chip->ops->reset_dsp(chip); 275 280 } 276 281 ··· 297 304 static inline void vx_pseudo_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime, 298 305 struct vx_pipe *pipe, int count) 299 306 { 300 - snd_assert(chip->ops->dma_write, return); 301 307 chip->ops->dma_write(chip, runtime, pipe, count); 302 308 } 303 309 304 310 static inline void vx_pseudo_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime, 305 311 struct vx_pipe *pipe, int count) 306 312 { 307 - snd_assert(chip->ops->dma_read, return); 308 313 chip->ops->dma_read(chip, runtime, pipe, count); 309 314 } 310 315
+3 -2
sound/arm/sa11xx-uda1341.c
··· 442 442 443 443 /* we are requested to process synchronization DMA transfer */ 444 444 if (s->tx_spin) { 445 - snd_assert(s->stream_id == SNDRV_PCM_STREAM_PLAYBACK, return); 445 + if (snd_BUG_ON(s->stream_id != SNDRV_PCM_STREAM_PLAYBACK)) 446 + return; 446 447 /* fill the xmit dma buffers and return */ 447 448 #ifdef HH_VERSION 448 449 sa1100_dma_set_spin(s->dmach, FORCE_CLOCK_ADDR, FORCE_CLOCK_SIZE); ··· 473 472 continue; /* special case */ 474 473 } else { 475 474 offset = dma_size * s->period; 476 - snd_assert(dma_size <= DMA_BUF_SIZE, ); 475 + snd_BUG_ON(dma_size > DMA_BUF_SIZE); 477 476 } 478 477 #ifdef HH_VERSION 479 478 ret = sa1100_dma_queue_buffer(s->dmach, s, runtime->dma_addr + offset, dma_size);
+2 -1
sound/drivers/dummy.c
··· 565 565 unsigned int idx; 566 566 int err; 567 567 568 - snd_assert(dummy != NULL, return -EINVAL); 568 + if (snd_BUG_ON(!dummy)) 569 + return -EINVAL; 569 570 spin_lock_init(&dummy->mixer_lock); 570 571 strcpy(card->mixername, "Dummy Mixer"); 571 572
+4 -2
sound/drivers/opl3/opl3_lib.c
··· 139 139 * If we had an OPL4 chip, opl3->hardware would have been set 140 140 * by the OPL4 driver; so we can assume OPL3 here. 141 141 */ 142 - snd_assert(opl3->r_port != 0, return -ENODEV); 142 + if (snd_BUG_ON(!opl3->r_port)) 143 + return -ENODEV; 143 144 opl3->hardware = OPL3_HW_OPL3; 144 145 } 145 146 return 0; ··· 325 324 326 325 static int snd_opl3_free(struct snd_opl3 *opl3) 327 326 { 328 - snd_assert(opl3 != NULL, return -ENXIO); 327 + if (snd_BUG_ON(!opl3)) 328 + return -ENXIO; 329 329 if (opl3->private_free) 330 330 opl3->private_free(opl3); 331 331 snd_opl3_clear_patches(opl3);
+4 -2
sound/drivers/opl3/opl3_midi.c
··· 617 617 618 618 struct snd_opl3_voice *vp, *vp2; 619 619 620 - snd_assert(voice < MAX_OPL3_VOICES, return); 620 + if (snd_BUG_ON(voice >= MAX_OPL3_VOICES)) 621 + return; 621 622 622 623 vp = &opl3->voices[voice]; 623 624 if (voice < MAX_OPL2_VOICES) { ··· 738 737 739 738 struct snd_opl3_voice *vp; 740 739 741 - snd_assert(voice < MAX_OPL3_VOICES, return); 740 + if (snd_BUG_ON(voice >= MAX_OPL3_VOICES)) 741 + return; 742 742 743 743 vp = &opl3->voices[voice]; 744 744 if (vp->chan == NULL)
+10 -5
sound/drivers/opl3/opl3_oss.c
··· 162 162 struct snd_opl3 *opl3 = closure; 163 163 int err; 164 164 165 - snd_assert(arg != NULL, return -ENXIO); 165 + if (snd_BUG_ON(!arg)) 166 + return -ENXIO; 166 167 167 168 if ((err = snd_opl3_synth_setup(opl3)) < 0) 168 169 return err; ··· 185 184 { 186 185 struct snd_opl3 *opl3; 187 186 188 - snd_assert(arg != NULL, return -ENXIO); 187 + if (snd_BUG_ON(!arg)) 188 + return -ENXIO; 189 189 opl3 = arg->private_data; 190 190 191 191 snd_opl3_synth_cleanup(opl3); ··· 208 206 char name[32]; 209 207 int err, type; 210 208 211 - snd_assert(arg != NULL, return -ENXIO); 209 + if (snd_BUG_ON(!arg)) 210 + return -ENXIO; 212 211 opl3 = arg->private_data; 213 212 214 213 if (format == FM_PATCH) ··· 249 246 { 250 247 struct snd_opl3 *opl3; 251 248 252 - snd_assert(arg != NULL, return -ENXIO); 249 + if (snd_BUG_ON(!arg)) 250 + return -ENXIO; 253 251 opl3 = arg->private_data; 254 252 switch (cmd) { 255 253 case SNDCTL_FM_LOAD_INSTR: ··· 275 271 { 276 272 struct snd_opl3 *opl3; 277 273 278 - snd_assert(arg != NULL, return -ENXIO); 274 + if (snd_BUG_ON(!arg)) 275 + return -ENXIO; 279 276 opl3 = arg->private_data; 280 277 281 278 return 0;
+2 -1
sound/drivers/opl3/opl3_synth.c
··· 92 92 struct snd_opl3 *opl3 = hw->private_data; 93 93 void __user *argp = (void __user *)arg; 94 94 95 - snd_assert(opl3 != NULL, return -EINVAL); 95 + if (snd_BUG_ON(!opl3)) 96 + return -EINVAL; 96 97 97 98 switch (cmd) { 98 99 /* get information */
+1 -1
sound/drivers/opl4/opl4_synth.c
··· 467 467 if (!list_empty(&opl4->off_voices)) 468 468 return list_entry(opl4->off_voices.next, struct opl4_voice, list); 469 469 /* then get the oldest key-on voice */ 470 - snd_assert(!list_empty(&opl4->on_voices), ); 470 + snd_BUG_ON(list_empty(&opl4->on_voices)); 471 471 return list_entry(opl4->on_voices.next, struct opl4_voice, list); 472 472 } 473 473
+2 -1
sound/drivers/vx/vx_cmd.c
··· 99 99 */ 100 100 void vx_init_rmh(struct vx_rmh *rmh, unsigned int cmd) 101 101 { 102 - snd_assert(cmd < CMD_LAST_INDEX, return); 102 + if (snd_BUG_ON(cmd >= CMD_LAST_INDEX)) 103 + return; 103 104 rmh->LgCmd = vx_dsp_cmds[cmd].length; 104 105 rmh->LgStat = vx_dsp_cmds[cmd].st_length; 105 106 rmh->DspStat = vx_dsp_cmds[cmd].st_type;
+14 -7
sound/drivers/vx/vx_core.c
··· 205 205 206 206 if (size < 1) 207 207 return 0; 208 - snd_assert(size <= SIZE_MAX_STATUS, return -EINVAL); 208 + if (snd_BUG_ON(size > SIZE_MAX_STATUS)) 209 + return -EINVAL; 209 210 210 211 for (i = 1; i <= size; i++) { 211 212 /* trigger an irq MESS_WRITE_NEXT */ ··· 426 425 int no_fillup = vx_has_new_dsp(chip); 427 426 428 427 /* check the length of boot image */ 429 - snd_assert(boot->size > 0, return -EINVAL); 430 - snd_assert(boot->size % 3 == 0, return -EINVAL); 428 + if (boot->size <= 0) 429 + return -EINVAL; 430 + if (boot->size % 3) 431 + return -EINVAL; 431 432 #if 0 432 433 { 433 434 /* more strict check */ 434 435 unsigned int c = ((u32)boot->data[0] << 16) | ((u32)boot->data[1] << 8) | boot->data[2]; 435 - snd_assert(boot->size == (c + 2) * 3, return -EINVAL); 436 + if (boot->size != (c + 2) * 3) 437 + return -EINVAL; 436 438 } 437 439 #endif 438 440 ··· 558 554 */ 559 555 static void vx_reset_board(struct vx_core *chip, int cold_reset) 560 556 { 561 - snd_assert(chip->ops->reset_board, return); 557 + if (snd_BUG_ON(!chip->ops->reset_board)) 558 + return; 562 559 563 560 /* current source, later sync'ed with target */ 564 561 chip->audio_source = VX_AUDIO_SRC_LINE; ··· 678 673 unsigned int csum = 0; 679 674 const unsigned char *image, *cptr; 680 675 681 - snd_assert(dsp->size % 3 == 0, return -EINVAL); 676 + if (dsp->size % 3) 677 + return -EINVAL; 682 678 683 679 vx_toggle_dac_mute(chip, 1); 684 680 ··· 781 775 { 782 776 struct vx_core *chip; 783 777 784 - snd_assert(card && hw && ops, return NULL); 778 + if (snd_BUG_ON(!card || !hw || !ops)) 779 + return NULL; 785 780 786 781 chip = kzalloc(sizeof(*chip) + extra_size, GFP_KERNEL); 787 782 if (! chip) {
+4 -2
sound/drivers/vx/vx_hwdep.c
··· 141 141 }; 142 142 struct vx_core *vx = hw->private_data; 143 143 144 - snd_assert(type_ids[vx->type], return -EINVAL); 144 + if (snd_BUG_ON(!type_ids[vx->type])) 145 + return -EINVAL; 145 146 strcpy(info->id, type_ids[vx->type]); 146 147 if (vx_is_pcmcia(vx)) 147 148 info->num_dsps = 4; ··· 169 168 int index, err; 170 169 struct firmware *fw; 171 170 172 - snd_assert(vx->ops->load_dsp, return -ENXIO); 171 + if (snd_BUG_ON(!vx->ops->load_dsp)) 172 + return -ENXIO; 173 173 174 174 fw = kmalloc(sizeof(*fw), GFP_KERNEL); 175 175 if (! fw) {
+2 -1
sound/drivers/vx/vx_mixer.c
··· 34 34 { 35 35 unsigned long flags; 36 36 37 - snd_assert(chip->ops->write_codec, return); 37 + if (snd_BUG_ON(!chip->ops->write_codec)) 38 + return; 38 39 39 40 if (chip->chip_status & VX_STAT_IS_STALE) 40 41 return;
+6 -3
sound/drivers/vx/vx_pcm.c
··· 587 587 return -EBUSY; 588 588 589 589 audio = subs->pcm->device * 2; 590 - snd_assert(audio < chip->audio_outs, return -EINVAL); 590 + if (snd_BUG_ON(audio >= chip->audio_outs)) 591 + return -EINVAL; 591 592 592 593 /* playback pipe may have been already allocated for monitoring */ 593 594 pipe = chip->playback_pipes[audio]; ··· 997 996 return -EBUSY; 998 997 999 998 audio = subs->pcm->device * 2; 1000 - snd_assert(audio < chip->audio_ins, return -EINVAL); 999 + if (snd_BUG_ON(audio >= chip->audio_ins)) 1000 + return -EINVAL; 1001 1001 err = vx_alloc_pipe(chip, 1, audio, 2, &pipe); 1002 1002 if (err < 0) 1003 1003 return err; ··· 1216 1214 } 1217 1215 if (capture) 1218 1216 continue; 1219 - snd_assert(p >= 0 && (unsigned int)p < chip->audio_outs,); 1217 + if (snd_BUG_ON(p < 0 || p >= chip->audio_outs)) 1218 + continue; 1220 1219 pipe = chip->playback_pipes[p]; 1221 1220 if (pipe && pipe->substream) { 1222 1221 vx_pcm_playback_update(chip, pipe->substream, pipe);
+4 -2
sound/drivers/vx/vx_uer.c
··· 163 163 { 164 164 int hexfreq; 165 165 166 - snd_assert(freq > 0, return 0); 166 + if (snd_BUG_ON(freq <= 0)) 167 + return 0; 167 168 168 169 hexfreq = (28224000 * 10) / freq; 169 170 hexfreq = (hexfreq + 5) / 10; 170 171 171 172 /* max freq = 55125 Hz */ 172 - snd_assert(hexfreq > 0x00000200, return 0); 173 + if (snd_BUG_ON(hexfreq <= 0x00000200)) 174 + return 0; 173 175 174 176 if (hexfreq <= 0x03ff) 175 177 return hexfreq - 0x00000201;
+10 -5
sound/i2c/cs8427.c
··· 314 314 unsigned long end_time; 315 315 int data, aes3input = 0; 316 316 317 - snd_assert(cs8427, return); 317 + if (snd_BUG_ON(!cs8427)) 318 + return; 318 319 chip = cs8427->private_data; 319 320 snd_i2c_lock(cs8427->bus); 320 321 if ((chip->regmap[CS8427_REG_CLOCKSOURCE] & CS8427_RXDAES3INPUT) == ··· 527 526 unsigned int idx; 528 527 int err; 529 528 530 - snd_assert(play_substream && cap_substream, return -EINVAL); 529 + if (snd_BUG_ON(!play_substream || !cap_substream)) 530 + return -EINVAL; 531 531 for (idx = 0; idx < ARRAY_SIZE(snd_cs8427_iec958_controls); idx++) { 532 532 kctl = snd_ctl_new1(&snd_cs8427_iec958_controls[idx], cs8427); 533 533 if (kctl == NULL) ··· 545 543 546 544 chip->playback.substream = play_substream; 547 545 chip->capture.substream = cap_substream; 548 - snd_assert(chip->playback.pcm_ctl, return -EIO); 546 + if (snd_BUG_ON(!chip->playback.pcm_ctl)) 547 + return -EIO; 549 548 return 0; 550 549 } 551 550 ··· 556 553 { 557 554 struct cs8427 *chip; 558 555 559 - snd_assert(cs8427, return -ENXIO); 556 + if (snd_BUG_ON(!cs8427)) 557 + return -ENXIO; 560 558 chip = cs8427->private_data; 561 559 if (active) 562 560 memcpy(chip->playback.pcm_status, ··· 577 573 char *status; 578 574 int err, reset; 579 575 580 - snd_assert(cs8427, return -ENXIO); 576 + if (snd_BUG_ON(!cs8427)) 577 + return -ENXIO; 581 578 chip = cs8427->private_data; 582 579 status = chip->playback.pcm_status; 583 580 snd_i2c_lock(cs8427->bus);
+4 -2
sound/i2c/i2c.c
··· 49 49 struct snd_i2c_bus *slave; 50 50 struct snd_i2c_device *device; 51 51 52 - snd_assert(bus != NULL, return -EINVAL); 52 + if (snd_BUG_ON(!bus)) 53 + return -EINVAL; 53 54 while (!list_empty(&bus->devices)) { 54 55 device = snd_i2c_device(bus->devices.next); 55 56 snd_i2c_device_free(device); ··· 114 113 struct snd_i2c_device *device; 115 114 116 115 *rdevice = NULL; 117 - snd_assert(bus != NULL, return -EINVAL); 116 + if (snd_BUG_ON(!bus)) 117 + return -EINVAL; 118 118 device = kzalloc(sizeof(*device), GFP_KERNEL); 119 119 if (device == NULL) 120 120 return -ENOMEM;
+2 -1
sound/i2c/l3/uda1341.c
··· 771 771 struct l3_client *clnt; 772 772 int idx, err; 773 773 774 - snd_assert(card != NULL, return -EINVAL); 774 + if (snd_BUG_ON(!card)) 775 + return -EINVAL; 775 776 776 777 clnt = kzalloc(sizeof(*clnt), GFP_KERNEL); 777 778 if (clnt == NULL)
+2 -1
sound/i2c/other/ak4114.c
··· 475 475 unsigned int idx; 476 476 int err; 477 477 478 - snd_assert(cap_substream, return -EINVAL); 478 + if (snd_BUG_ON(!cap_substream)) 479 + return -EINVAL; 479 480 ak4114->playback_substream = ply_substream; 480 481 ak4114->capture_substream = cap_substream; 481 482 for (idx = 0; idx < AK4114_CONTROLS; idx++) {
+2 -1
sound/i2c/other/ak4117.c
··· 431 431 unsigned int idx; 432 432 int err; 433 433 434 - snd_assert(cap_substream, return -EINVAL); 434 + if (snd_BUG_ON(!cap_substream)) 435 + return -EINVAL; 435 436 ak4117->substream = cap_substream; 436 437 for (idx = 0; idx < AK4117_CONTROLS; idx++) { 437 438 kctl = snd_ctl_new1(&snd_ak4117_iec958_controls[idx], ak4117);
+4 -2
sound/mips/au1x00.c
··· 190 190 static void 191 191 au1000_dma_stop(struct audio_stream *stream) 192 192 { 193 - snd_assert(stream->buffer, return); 193 + if (snd_BUG_ON(!stream->buffer)) 194 + return; 194 195 disable_dma(stream->dma); 195 196 } 196 197 197 198 static void 198 199 au1000_dma_start(struct audio_stream *stream) 199 200 { 200 - snd_assert(stream->buffer, return); 201 + if (snd_BUG_ON(!stream->buffer)) 202 + return; 201 203 202 204 init_dma(stream->dma); 203 205 if (get_dma_active_buffer(stream->dma) == 0) {
+2 -1
sound/parisc/harmony.c
··· 868 868 struct snd_card *card = h->card; 869 869 int idx, err; 870 870 871 - snd_assert(h != NULL, return -EINVAL); 871 + if (snd_BUG_ON(!h)) 872 + reutrn -EINVAL; 872 873 strcpy(card->mixername, "Harmony Gain control interface"); 873 874 874 875 for (idx = 0; idx < HARMONY_CONTROLS; idx++) {
+2 -1
sound/pcmcia/vx/vxp_ops.c
··· 408 408 int offset = pipe->hw_ptr; 409 409 unsigned short *addr = (unsigned short *)(runtime->dma_area + offset); 410 410 411 - snd_assert(count % 2 == 0, return); 411 + if (snd_BUG_ON(count % 2)) 412 + return; 412 413 vx_setup_pseudo_dma(chip, 0); 413 414 if (offset + count > pipe->buffer_bytes) { 414 415 int length = pipe->buffer_bytes - offset;
+8 -15
sound/ppc/awacs.c
··· 319 319 static void awacs_amp_free(struct snd_pmac *chip) 320 320 { 321 321 struct awacs_amp *amp = chip->mixer_data; 322 - snd_assert(amp, return); 322 + if (!amp) 323 + return; 323 324 kfree(amp); 324 325 chip->mixer_data = NULL; 325 326 chip->mixer_free = NULL; ··· 346 345 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 347 346 int index = kcontrol->private_value; 348 347 struct awacs_amp *amp = chip->mixer_data; 349 - snd_assert(amp, return -EINVAL); 350 - snd_assert(index >= 0 && index <= 1, return -EINVAL); 348 + 351 349 ucontrol->value.integer.value[0] = 31 - (amp->amp_vol[index][0] & 31); 352 350 ucontrol->value.integer.value[1] = 31 - (amp->amp_vol[index][1] & 31); 353 351 return 0; ··· 359 359 int index = kcontrol->private_value; 360 360 int vol[2]; 361 361 struct awacs_amp *amp = chip->mixer_data; 362 - snd_assert(amp, return -EINVAL); 363 - snd_assert(index >= 0 && index <= 1, return -EINVAL); 364 362 365 363 vol[0] = (31 - (ucontrol->value.integer.value[0] & 31)) 366 364 | (amp->amp_vol[index][0] & 32); ··· 373 375 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 374 376 int index = kcontrol->private_value; 375 377 struct awacs_amp *amp = chip->mixer_data; 376 - snd_assert(amp, return -EINVAL); 377 - snd_assert(index >= 0 && index <= 1, return -EINVAL); 378 + 378 379 ucontrol->value.integer.value[0] = (amp->amp_vol[index][0] & 32) 379 380 ? 0 : 1; 380 381 ucontrol->value.integer.value[1] = (amp->amp_vol[index][1] & 32) ··· 388 391 int index = kcontrol->private_value; 389 392 int vol[2]; 390 393 struct awacs_amp *amp = chip->mixer_data; 391 - snd_assert(amp, return -EINVAL); 392 - snd_assert(index >= 0 && index <= 1, return -EINVAL); 393 394 394 395 vol[0] = (ucontrol->value.integer.value[0] ? 0 : 32) 395 396 | (amp->amp_vol[index][0] & 31); ··· 412 417 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 413 418 int index = kcontrol->private_value; 414 419 struct awacs_amp *amp = chip->mixer_data; 415 - snd_assert(amp, return -EINVAL); 416 - snd_assert(index >= 0 && index <= 1, return -EINVAL); 420 + 417 421 ucontrol->value.integer.value[0] = amp->amp_tone[index]; 418 422 return 0; 419 423 } ··· 424 430 int index = kcontrol->private_value; 425 431 struct awacs_amp *amp = chip->mixer_data; 426 432 unsigned int val; 427 - snd_assert(amp, return -EINVAL); 428 - snd_assert(index >= 0 && index <= 1, return -EINVAL); 433 + 429 434 val = ucontrol->value.integer.value[0]; 430 435 if (val > 14) 431 436 return -EINVAL; ··· 451 458 { 452 459 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 453 460 struct awacs_amp *amp = chip->mixer_data; 454 - snd_assert(amp, return -EINVAL); 461 + 455 462 ucontrol->value.integer.value[0] = amp->amp_master; 456 463 return 0; 457 464 } ··· 462 469 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 463 470 struct awacs_amp *amp = chip->mixer_data; 464 471 unsigned int val; 465 - snd_assert(amp, return -EINVAL); 472 + 466 473 val = ucontrol->value.integer.value[0]; 467 474 if (val > 99) 468 475 return -EINVAL;
+4 -2
sound/ppc/beep.c
··· 185 185 struct snd_ctl_elem_value *ucontrol) 186 186 { 187 187 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 188 - snd_assert(chip->beep, return -ENXIO); 188 + if (snd_BUG_ON(!chip->beep)) 189 + return -ENXIO; 189 190 ucontrol->value.integer.value[0] = chip->beep->volume; 190 191 return 0; 191 192 } ··· 196 195 { 197 196 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 198 197 unsigned int oval, nval; 199 - snd_assert(chip->beep, return -ENXIO); 198 + if (snd_BUG_ON(!chip->beep)) 199 + return -ENXIO; 200 200 oval = chip->beep->volume; 201 201 nval = ucontrol->value.integer.value[0]; 202 202 if (nval > 100)
+6 -11
sound/ppc/tumbler.c
··· 263 263 { 264 264 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 265 265 struct pmac_tumbler *mix = chip->mixer_data; 266 - snd_assert(mix, return -ENODEV); 266 + 267 267 ucontrol->value.integer.value[0] = mix->master_vol[0]; 268 268 ucontrol->value.integer.value[1] = mix->master_vol[1]; 269 269 return 0; ··· 277 277 unsigned int vol[2]; 278 278 int change; 279 279 280 - snd_assert(mix, return -ENODEV); 281 280 vol[0] = ucontrol->value.integer.value[0]; 282 281 vol[1] = ucontrol->value.integer.value[1]; 283 282 if (vol[0] >= ARRAY_SIZE(master_volume_table) || ··· 298 299 { 299 300 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 300 301 struct pmac_tumbler *mix = chip->mixer_data; 301 - snd_assert(mix, return -ENODEV); 302 + 302 303 ucontrol->value.integer.value[0] = mix->master_switch[0]; 303 304 ucontrol->value.integer.value[1] = mix->master_switch[1]; 304 305 return 0; ··· 311 312 struct pmac_tumbler *mix = chip->mixer_data; 312 313 int change; 313 314 314 - snd_assert(mix, return -ENODEV); 315 315 change = mix->master_switch[0] != ucontrol->value.integer.value[0] || 316 316 mix->master_switch[1] != ucontrol->value.integer.value[1]; 317 317 if (change) { ··· 805 807 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 806 808 struct pmac_tumbler *mix = chip->mixer_data; 807 809 808 - snd_assert(mix, return -ENODEV); 809 810 ucontrol->value.enumerated.item[0] = mix->capture_source; 810 811 return 0; 811 812 } ··· 816 819 struct pmac_tumbler *mix = chip->mixer_data; 817 820 int change; 818 821 819 - snd_assert(mix, return -ENODEV); 820 822 change = ucontrol->value.enumerated.item[0] != mix->capture_source; 821 823 if (change) { 822 824 mix->capture_source = !!ucontrol->value.enumerated.item[0]; ··· 974 978 return; 975 979 976 980 mix = chip->mixer_data; 977 - snd_assert(mix, return); 981 + if (snd_BUG_ON(!mix)) 982 + return; 978 983 979 984 headphone = tumbler_detect_headphone(chip); 980 985 lineout = tumbler_detect_lineout(chip); ··· 1030 1033 if (chip->auto_mute) { 1031 1034 struct pmac_tumbler *mix; 1032 1035 mix = chip->mixer_data; 1033 - snd_assert(mix, return); 1036 + if (snd_BUG_ON(!mix)) 1037 + return; 1034 1038 mix->auto_mute_notify = do_notify; 1035 1039 schedule_work(&device_change); 1036 1040 } ··· 1225 1227 { 1226 1228 struct pmac_tumbler *mix = chip->mixer_data; 1227 1229 1228 - snd_assert(mix, return); 1229 - 1230 1230 mix->acs &= ~1; 1231 1231 mix->master_switch[0] = mix->save_master_switch[0]; 1232 1232 mix->master_switch[1] = mix->save_master_switch[1]; ··· 1271 1275 { 1272 1276 int irq; 1273 1277 struct pmac_tumbler *mix = chip->mixer_data; 1274 - snd_assert(mix, return -EINVAL); 1275 1278 1276 1279 if (tumbler_find_device("audio-hw-reset", 1277 1280 "platform-do-hw-reset",
+2 -1
sound/sh/aica.c
··· 106 106 { 107 107 int i; 108 108 unsigned long flags; 109 - snd_assert(length % 4 == 0, return); 109 + if (snd_BUG_ON(length % 4)) 110 + return; 110 111 for (i = 0; i < length; i++) { 111 112 if (!(i % 8)) 112 113 spu_write_wait();
+2 -17
sound/sparc/amd7930.c
··· 765 765 /* playback count */ 1, 766 766 /* capture count */ 1, &pcm)) < 0) 767 767 return err; 768 - snd_assert(pcm != NULL, return -EINVAL); 769 768 770 769 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_amd7930_playback_ops); 771 770 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_amd7930_capture_ops); ··· 787 788 788 789 static int snd_amd7930_info_volume(struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo) 789 790 { 790 - int type = kctl->private_value; 791 - 792 - snd_assert(type == VOLUME_MONITOR || 793 - type == VOLUME_CAPTURE || 794 - type == VOLUME_PLAYBACK, return -EINVAL); 795 - (void) type; 796 - 797 791 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 798 792 uinfo->count = 1; 799 793 uinfo->value.integer.min = 0; ··· 800 808 struct snd_amd7930 *amd = snd_kcontrol_chip(kctl); 801 809 int type = kctl->private_value; 802 810 int *swval; 803 - 804 - snd_assert(type == VOLUME_MONITOR || 805 - type == VOLUME_CAPTURE || 806 - type == VOLUME_PLAYBACK, return -EINVAL); 807 811 808 812 switch (type) { 809 813 case VOLUME_MONITOR: ··· 825 837 unsigned long flags; 826 838 int type = kctl->private_value; 827 839 int *swval, change; 828 - 829 - snd_assert(type == VOLUME_MONITOR || 830 - type == VOLUME_CAPTURE || 831 - type == VOLUME_PLAYBACK, return -EINVAL); 832 840 833 841 switch (type) { 834 842 case VOLUME_MONITOR: ··· 888 904 struct snd_card *card; 889 905 int idx, err; 890 906 891 - snd_assert(amd != NULL && amd->card != NULL, return -EINVAL); 907 + if (snd_BUG_ON(!amd || !amd->card)) 908 + return -EINVAL; 892 909 893 910 card = amd->card; 894 911 strcpy(card->mixername, card->shortname);
+2 -1
sound/sparc/cs4231.c
··· 1560 1560 struct snd_cs4231 *chip = card->private_data; 1561 1561 int err, idx; 1562 1562 1563 - snd_assert(chip != NULL && chip->pcm != NULL, return -EINVAL); 1563 + if (snd_BUG_ON(!chip || !chip->pcm)) 1564 + return -EINVAL; 1564 1565 1565 1566 strcpy(card->mixername, chip->pcm->name); 1566 1567
+11 -6
sound/sparc/dbri.c
··· 2223 2223 /* playback count */ 1, 2224 2224 /* capture count */ 1, &pcm)) < 0) 2225 2225 return err; 2226 - snd_assert(pcm != NULL, return -EINVAL); 2227 2226 2228 2227 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_dbri_ops); 2229 2228 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_dbri_ops); ··· 2262 2263 { 2263 2264 struct snd_dbri *dbri = snd_kcontrol_chip(kcontrol); 2264 2265 struct dbri_streaminfo *info; 2265 - snd_assert(dbri != NULL, return -EINVAL); 2266 + 2267 + if (snd_BUG_ON(!dbri)) 2268 + return -EINVAL; 2266 2269 info = &dbri->stream_info[kcontrol->private_value]; 2267 - snd_assert(info != NULL, return -EINVAL); 2268 2270 2269 2271 ucontrol->value.integer.value[0] = info->left_gain; 2270 2272 ucontrol->value.integer.value[1] = info->right_gain; ··· 2331 2331 int shift = (kcontrol->private_value >> 8) & 0xff; 2332 2332 int mask = (kcontrol->private_value >> 16) & 0xff; 2333 2333 int invert = (kcontrol->private_value >> 24) & 1; 2334 - snd_assert(dbri != NULL, return -EINVAL); 2334 + 2335 + if (snd_BUG_ON(!dbri)) 2336 + return -EINVAL; 2335 2337 2336 2338 if (elem < 4) 2337 2339 ucontrol->value.integer.value[0] = ··· 2358 2356 int invert = (kcontrol->private_value >> 24) & 1; 2359 2357 int changed = 0; 2360 2358 unsigned short val; 2361 - snd_assert(dbri != NULL, return -EINVAL); 2359 + 2360 + if (snd_BUG_ON(!dbri)) 2361 + return -EINVAL; 2362 2362 2363 2363 val = (ucontrol->value.integer.value[0] & mask); 2364 2364 if (invert == 1) ··· 2436 2432 int idx, err; 2437 2433 struct snd_dbri *dbri; 2438 2434 2439 - snd_assert(card != NULL && card->private_data != NULL, return -EINVAL); 2435 + if (snd_BUG_ON(!card || !card->private_data)) 2436 + return -EINVAL; 2440 2437 dbri = card->private_data; 2441 2438 2442 2439 strcpy(card->mixername, card->shortname);
+4 -4
sound/synth/emux/emux.c
··· 93 93 int err; 94 94 struct snd_sf_callback sf_cb; 95 95 96 - snd_assert(emu->hw != NULL, return -EINVAL); 97 - snd_assert(emu->max_voices > 0, return -EINVAL); 98 - snd_assert(card != NULL, return -EINVAL); 99 - snd_assert(name != NULL, return -EINVAL); 96 + if (snd_BUG_ON(!emu->hw || emu->max_voices <= 0)) 97 + return -EINVAL; 98 + if (snd_BUG_ON(!card || !name)) 99 + return -EINVAL; 100 100 101 101 emu->card = card; 102 102 emu->name = kstrdup(name, GFP_KERNEL);
+4 -4
sound/synth/emux/emux_nrpn.c
··· 289 289 struct snd_emux_port *port; 290 290 291 291 port = p; 292 - snd_assert(port != NULL, return); 293 - snd_assert(chan != NULL, return); 292 + if (snd_BUG_ON(!port || !chan)) 293 + return; 294 294 295 295 if (chan->control[MIDI_CTL_NONREG_PARM_NUM_MSB] == 127 && 296 296 chan->control[MIDI_CTL_NONREG_PARM_NUM_LSB] <= 26) { ··· 379 379 struct snd_emux *emu; 380 380 381 381 port = p; 382 - snd_assert(port != NULL, return); 383 - snd_assert(chset != NULL, return); 382 + if (snd_BUG_ON(!port || !chset)) 383 + return; 384 384 emu = port->emu; 385 385 386 386 switch (parsed) {
+28 -14
sound/synth/emux/emux_oss.c
··· 114 114 char tmpname[64]; 115 115 116 116 emu = closure; 117 - snd_assert(arg != NULL && emu != NULL, return -ENXIO); 117 + if (snd_BUG_ON(!arg || !emu)) 118 + return -ENXIO; 118 119 119 120 mutex_lock(&emu->register_mutex); 120 121 ··· 184 183 struct snd_emux *emu; 185 184 struct snd_emux_port *p; 186 185 187 - snd_assert(arg != NULL, return -ENXIO); 186 + if (snd_BUG_ON(!arg)) 187 + return -ENXIO; 188 188 p = arg->private_data; 189 - snd_assert(p != NULL, return -ENXIO); 189 + if (snd_BUG_ON(!p)) 190 + return -ENXIO; 190 191 191 192 emu = p->emu; 192 - snd_assert(emu != NULL, return -ENXIO); 193 + if (snd_BUG_ON(!emu)) 194 + return -ENXIO; 193 195 194 196 mutex_lock(&emu->register_mutex); 195 197 snd_emux_sounds_off_all(p); ··· 216 212 struct snd_emux_port *p; 217 213 int rc; 218 214 219 - snd_assert(arg != NULL, return -ENXIO); 215 + if (snd_BUG_ON(!arg)) 216 + return -ENXIO; 220 217 p = arg->private_data; 221 - snd_assert(p != NULL, return -ENXIO); 218 + if (snd_BUG_ON(!p)) 219 + return -ENXIO; 222 220 223 221 emu = p->emu; 224 - snd_assert(emu != NULL, return -ENXIO); 222 + if (snd_BUG_ON(!emu)) 223 + return -ENXIO; 225 224 226 225 if (format == GUS_PATCH) 227 226 rc = snd_soundfont_load_guspatch(emu->sflist, buf, count, ··· 259 252 struct snd_emux_port *p; 260 253 struct snd_emux *emu; 261 254 262 - snd_assert(arg != NULL, return -ENXIO); 255 + if (snd_BUG_ON(!arg)) 256 + return -ENXIO; 263 257 p = arg->private_data; 264 - snd_assert(p != NULL, return -ENXIO); 258 + if (snd_BUG_ON(!p)) 259 + return -ENXIO; 265 260 266 261 emu = p->emu; 267 - snd_assert(emu != NULL, return -ENXIO); 262 + if (snd_BUG_ON(!emu)) 263 + return -ENXIO; 268 264 269 265 switch (cmd) { 270 266 case SNDCTL_SEQ_RESETSAMPLES: ··· 292 282 { 293 283 struct snd_emux_port *p; 294 284 295 - snd_assert(arg != NULL, return -ENXIO); 285 + if (snd_BUG_ON(!arg)) 286 + return -ENXIO; 296 287 p = arg->private_data; 297 - snd_assert(p != NULL, return -ENXIO); 288 + if (snd_BUG_ON(!p)) 289 + return -ENXIO; 298 290 snd_emux_reset_port(p); 299 291 return 0; 300 292 } ··· 314 302 unsigned char cmd, *data; 315 303 316 304 p = private_data; 317 - snd_assert(p != NULL, return -EINVAL); 305 + if (snd_BUG_ON(!p)) 306 + return -EINVAL; 318 307 emu = p->emu; 319 - snd_assert(emu != NULL, return -EINVAL); 308 + if (snd_BUG_ON(!emu)) 309 + return -EINVAL; 320 310 if (ev->type != SNDRV_SEQ_EVENT_OSS) 321 311 return snd_emux_event_input(ev, direct, private_data, atomic, hop); 322 312
+10 -5
sound/synth/emux/emux_seq.c
··· 257 257 struct snd_emux_port *port; 258 258 259 259 port = private_data; 260 - snd_assert(port != NULL && ev != NULL, return -EINVAL); 260 + if (snd_BUG_ON(!port || !ev)) 261 + return -EINVAL; 261 262 262 263 snd_midi_process_event(&emux_ops, ev, &port->chset); 263 264 ··· 309 308 struct snd_emux *emu; 310 309 311 310 p = private_data; 312 - snd_assert(p != NULL, return -EINVAL); 311 + if (snd_BUG_ON(!p)) 312 + return -EINVAL; 313 313 emu = p->emu; 314 - snd_assert(emu != NULL, return -EINVAL); 314 + if (snd_BUG_ON(!emu)) 315 + return -EINVAL; 315 316 316 317 mutex_lock(&emu->register_mutex); 317 318 snd_emux_init_port(p); ··· 332 329 struct snd_emux *emu; 333 330 334 331 p = private_data; 335 - snd_assert(p != NULL, return -EINVAL); 332 + if (snd_BUG_ON(!p)) 333 + return -EINVAL; 336 334 emu = p->emu; 337 - snd_assert(emu != NULL, return -EINVAL); 335 + if (snd_BUG_ON(!emu)) 336 + return -EINVAL; 338 337 339 338 mutex_lock(&emu->register_mutex); 340 339 snd_emux_sounds_off_all(p);
+26 -21
sound/synth/emux/emux_synth.c
··· 66 66 struct snd_emux_port *port; 67 67 68 68 port = p; 69 - snd_assert(port != NULL && chan != NULL, return); 69 + if (snd_BUG_ON(!port || !chan)) 70 + return; 70 71 71 72 emu = port->emu; 72 - snd_assert(emu != NULL, return); 73 - snd_assert(emu->ops.get_voice != NULL, return); 74 - snd_assert(emu->ops.trigger != NULL, return); 73 + if (snd_BUG_ON(!emu || !emu->ops.get_voice || !emu->ops.trigger)) 74 + return; 75 75 76 76 key = note; /* remember the original note */ 77 77 nvoices = get_zone(emu, port, &note, vel, chan, table); ··· 164 164 struct snd_emux_port *port; 165 165 166 166 port = p; 167 - snd_assert(port != NULL && chan != NULL, return); 167 + if (snd_BUG_ON(!port || !chan)) 168 + return; 168 169 169 170 emu = port->emu; 170 - snd_assert(emu != NULL, return); 171 - snd_assert(emu->ops.release != NULL, return); 171 + if (snd_BUG_ON(!emu || !emu->ops.release)) 172 + return; 172 173 173 174 spin_lock_irqsave(&emu->voice_lock, flags); 174 175 for (ch = 0; ch < emu->max_voices; ch++) { ··· 243 242 struct snd_emux_port *port; 244 243 245 244 port = p; 246 - snd_assert(port != NULL && chan != NULL, return); 245 + if (snd_BUG_ON(!port || !chan)) 246 + return; 247 247 248 248 emu = port->emu; 249 - snd_assert(emu != NULL, return); 250 - snd_assert(emu->ops.update != NULL, return); 249 + if (snd_BUG_ON(!emu || !emu->ops.update)) 250 + return; 251 251 252 252 spin_lock_irqsave(&emu->voice_lock, flags); 253 253 for (ch = 0; ch < emu->max_voices; ch++) { ··· 278 276 return; 279 277 280 278 emu = port->emu; 281 - snd_assert(emu != NULL, return); 282 - snd_assert(emu->ops.update != NULL, return); 279 + if (snd_BUG_ON(!emu || !emu->ops.update)) 280 + return; 283 281 284 282 spin_lock_irqsave(&emu->voice_lock, flags); 285 283 for (i = 0; i < emu->max_voices; i++) { ··· 305 303 return; 306 304 307 305 emu = port->emu; 308 - snd_assert(emu != NULL, return); 309 - snd_assert(emu->ops.update != NULL, return); 306 + if (snd_BUG_ON(!emu || !emu->ops.update)) 307 + return; 310 308 311 309 spin_lock_irqsave(&emu->voice_lock, flags); 312 310 for (i = 0; i < emu->max_voices; i++) { ··· 328 326 struct snd_emux_port *port; 329 327 330 328 port = p; 331 - snd_assert(port != NULL && chan != NULL, return); 329 + if (snd_BUG_ON(!port || !chan)) 330 + return; 332 331 333 332 switch (type) { 334 333 case MIDI_CTL_MSB_MAIN_VOLUME: ··· 403 400 struct snd_emux_port *port; 404 401 405 402 port = p; 406 - snd_assert(port != NULL && chan != NULL, return); 403 + if (snd_BUG_ON(!port || !chan)) 404 + return; 407 405 408 406 emu = port->emu; 409 - snd_assert(emu != NULL, return); 410 - snd_assert(emu->ops.terminate != NULL, return); 407 + if (snd_BUG_ON(!emu || !emu->ops.terminate)) 408 + return; 411 409 412 410 terminate_note1(emu, note, chan, 1); 413 411 } ··· 455 451 struct snd_emux_voice *vp; 456 452 unsigned long flags; 457 453 458 - snd_assert(port != NULL, return); 454 + if (snd_BUG_ON(!port)) 455 + return; 459 456 emu = port->emu; 460 - snd_assert(emu != NULL, return); 461 - snd_assert(emu->ops.terminate != NULL, return); 457 + if (snd_BUG_ON(!emu || !emu->ops.terminate)) 458 + return; 462 459 463 460 spin_lock_irqsave(&emu->voice_lock, flags); 464 461 for (i = 0; i < emu->max_voices; i++) {
+6 -4
sound/synth/util_mem.c
··· 55 55 { 56 56 struct list_head *p; 57 57 58 - snd_assert(hdr != NULL, return); 58 + if (!hdr) 59 + return; 59 60 /* release all blocks */ 60 61 while ((p = hdr->block.next) != &hdr->block) { 61 62 list_del(p); ··· 75 74 unsigned int units, prev_offset; 76 75 struct list_head *p; 77 76 78 - snd_assert(hdr != NULL, return NULL); 79 - snd_assert(size > 0, return NULL); 77 + if (snd_BUG_ON(!hdr || size <= 0)) 78 + return NULL; 80 79 81 80 /* word alignment */ 82 81 units = size; ··· 162 161 */ 163 162 int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk) 164 163 { 165 - snd_assert(hdr && blk, return -EINVAL); 164 + if (snd_BUG_ON(!hdr || !blk)) 165 + return -EINVAL; 166 166 167 167 mutex_lock(&hdr->block_mutex); 168 168 __snd_util_mem_free(hdr, blk);
+8 -4
sound/usb/usbaudio.c
··· 841 841 return -EBADFD; 842 842 843 843 for (i = 0; i < subs->nurbs; i++) { 844 - snd_assert(subs->dataurb[i].urb, return -EINVAL); 844 + if (snd_BUG_ON(!subs->dataurb[i].urb)) 845 + return -EINVAL; 845 846 if (subs->ops.prepare(subs, runtime, subs->dataurb[i].urb) < 0) { 846 847 snd_printk(KERN_ERR "cannot prepare datapipe for urb %d\n", i); 847 848 goto __error; ··· 850 849 } 851 850 if (subs->syncpipe) { 852 851 for (i = 0; i < SYNC_URBS; i++) { 853 - snd_assert(subs->syncurb[i].urb, return -EINVAL); 852 + if (snd_BUG_ON(!subs->syncurb[i].urb)) 853 + return -EINVAL; 854 854 if (subs->ops.prepare_sync(subs, runtime, subs->syncurb[i].urb) < 0) { 855 855 snd_printk(KERN_ERR "cannot prepare syncpipe for urb %d\n", i); 856 856 goto __error; ··· 1323 1321 int err; 1324 1322 1325 1323 iface = usb_ifnum_to_if(dev, fmt->iface); 1326 - snd_assert(iface, return -EINVAL); 1324 + if (WARN_ON(!iface)) 1325 + return -EINVAL; 1327 1326 alts = &iface->altsetting[fmt->altset_idx]; 1328 1327 altsd = get_iface_desc(alts); 1329 - snd_assert(altsd->bAlternateSetting == fmt->altsetting, return -EINVAL); 1328 + if (WARN_ON(altsd->bAlternateSetting != fmt->altsetting)) 1329 + return -EINVAL; 1330 1330 1331 1331 if (fmt == subs->cur_audiofmt) 1332 1332 return 0;
+2 -1
sound/usb/usbmixer.c
··· 1389 1389 struct usb_mixer_elem_info *cval = kcontrol->private_data; 1390 1390 char **itemlist = (char **)kcontrol->private_value; 1391 1391 1392 - snd_assert(itemlist, return -EINVAL); 1392 + if (snd_BUG_ON(!itemlist)) 1393 + return -EINVAL; 1393 1394 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1394 1395 uinfo->count = 1; 1395 1396 uinfo->value.enumerated.items = cval->max;