Commit 622207dc authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

ALSA: Kill snd_assert() in sound/isa/*

Kill snd_assert() in sound/isa/*, either removed or replaced with
if () with snd_BUG_ON().
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 7eaa943c
...@@ -394,7 +394,8 @@ static int snd_ad1816a_timer_open(struct snd_timer *timer) ...@@ -394,7 +394,8 @@ static int snd_ad1816a_timer_open(struct snd_timer *timer)
static unsigned long snd_ad1816a_timer_resolution(struct snd_timer *timer) static unsigned long snd_ad1816a_timer_resolution(struct snd_timer *timer)
{ {
snd_assert(timer != NULL, return 0); if (snd_BUG_ON(!timer))
return 0;
return 10000; return 10000;
} }
...@@ -961,7 +962,8 @@ int __devinit snd_ad1816a_mixer(struct snd_ad1816a *chip) ...@@ -961,7 +962,8 @@ int __devinit snd_ad1816a_mixer(struct snd_ad1816a *chip)
unsigned int idx; unsigned int idx;
int err; int err;
snd_assert(chip != NULL && chip->card != NULL, return -EINVAL); if (snd_BUG_ON(!chip || !chip->card))
return -EINVAL;
card = chip->card; card = chip->card;
......
...@@ -967,7 +967,8 @@ int snd_cs4236_mixer(struct snd_wss *chip) ...@@ -967,7 +967,8 @@ int snd_cs4236_mixer(struct snd_wss *chip)
int err; int err;
struct snd_kcontrol_new *kcontrol; struct snd_kcontrol_new *kcontrol;
snd_assert(chip != NULL && chip->card != NULL, return -EINVAL); if (snd_BUG_ON(!chip || !chip->card))
return -EINVAL;
card = chip->card; card = chip->card;
strcpy(card->mixername, snd_wss_chip_id(chip)); strcpy(card->mixername, snd_wss_chip_id(chip));
......
...@@ -1009,7 +1009,8 @@ int snd_es1688_mixer(struct snd_es1688 *chip) ...@@ -1009,7 +1009,8 @@ int snd_es1688_mixer(struct snd_es1688 *chip)
int err; int err;
unsigned char reg, val; unsigned char reg, val;
snd_assert(chip != NULL && chip->card != NULL, return -EINVAL); if (snd_BUG_ON(!chip || !chip->card))
return -EINVAL;
card = chip->card; card = chip->card;
......
...@@ -276,9 +276,11 @@ static int snd_gus_init_dma_irq(struct snd_gus_card * gus, int latches) ...@@ -276,9 +276,11 @@ static int snd_gus_init_dma_irq(struct snd_gus_card * gus, int latches)
static unsigned char dmas[8] = static unsigned char dmas[8] =
{6, 1, 0, 2, 0, 3, 4, 5}; {6, 1, 0, 2, 0, 3, 4, 5};
snd_assert(gus != NULL, return -EINVAL); if (snd_BUG_ON(!gus))
return -EINVAL;
card = gus->card; card = gus->card;
snd_assert(card != NULL, return -EINVAL); if (snd_BUG_ON(!card))
return -EINVAL;
gus->mix_cntrl_reg &= 0xf8; gus->mix_cntrl_reg &= 0xf8;
gus->mix_cntrl_reg |= 0x01; /* disable MIC, LINE IN, enable LINE OUT */ gus->mix_cntrl_reg |= 0x01; /* disable MIC, LINE IN, enable LINE OUT */
......
...@@ -161,9 +161,11 @@ int snd_gf1_new_mixer(struct snd_gus_card * gus) ...@@ -161,9 +161,11 @@ int snd_gf1_new_mixer(struct snd_gus_card * gus)
unsigned int idx, max; unsigned int idx, max;
int err; int err;
snd_assert(gus != NULL, return -EINVAL); if (snd_BUG_ON(!gus))
return -EINVAL;
card = gus->card; card = gus->card;
snd_assert(card != NULL, return -EINVAL); if (snd_BUG_ON(!card))
return -EINVAL;
if (gus->ics_flag) if (gus->ics_flag)
snd_component_add(card, "ICS2101"); snd_component_add(card, "ICS2101");
......
...@@ -352,8 +352,10 @@ static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream, ...@@ -352,8 +352,10 @@ static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream,
bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2)); bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2));
len = samples_to_bytes(runtime, count); len = samples_to_bytes(runtime, count);
snd_assert(bpos <= pcmp->dma_size, return -EIO); if (snd_BUG_ON(bpos > pcmp->dma_size))
snd_assert(bpos + len <= pcmp->dma_size, return -EIO); return -EIO;
if (snd_BUG_ON(bpos + len > pcmp->dma_size))
return -EIO;
if (copy_from_user(runtime->dma_area + bpos, src, len)) if (copy_from_user(runtime->dma_area + bpos, src, len))
return -EFAULT; return -EFAULT;
if (snd_gf1_pcm_use_dma && len > 32) { if (snd_gf1_pcm_use_dma && len > 32) {
...@@ -381,8 +383,10 @@ static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream, ...@@ -381,8 +383,10 @@ static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream,
bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2)); bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2));
len = samples_to_bytes(runtime, count); len = samples_to_bytes(runtime, count);
snd_assert(bpos <= pcmp->dma_size, return -EIO); if (snd_BUG_ON(bpos > pcmp->dma_size))
snd_assert(bpos + len <= pcmp->dma_size, return -EIO); return -EIO;
if (snd_BUG_ON(bpos + len > pcmp->dma_size))
return -EIO;
snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos, count); snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos, count);
if (snd_gf1_pcm_use_dma && len > 32) { if (snd_gf1_pcm_use_dma && len > 32) {
return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len); return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len);
......
...@@ -675,7 +675,8 @@ static int __devinit snd_miro_mixer(struct snd_miro *miro) ...@@ -675,7 +675,8 @@ static int __devinit snd_miro_mixer(struct snd_miro *miro)
unsigned int idx; unsigned int idx;
int err; int err;
snd_assert(miro != NULL && miro->card != NULL, return -EINVAL); if (snd_BUG_ON(!miro || !miro->card))
return -EINVAL;
card = miro->card; card = miro->card;
......
...@@ -1023,7 +1023,8 @@ snd_emu8000_create_mixer(struct snd_card *card, struct snd_emu8000 *emu) ...@@ -1023,7 +1023,8 @@ snd_emu8000_create_mixer(struct snd_card *card, struct snd_emu8000 *emu)
{ {
int i, err = 0; int i, err = 0;
snd_assert(emu != NULL && card != NULL, return -EINVAL); if (snd_BUG_ON(!emu || !card))
return -EINVAL;
spin_lock_init(&emu->control_lock); spin_lock_init(&emu->control_lock);
......
...@@ -156,7 +156,8 @@ snd_emu8000_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, ...@@ -156,7 +156,8 @@ snd_emu8000_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp,
struct snd_emu8000 *emu; struct snd_emu8000 *emu;
emu = rec->hw; emu = rec->hw;
snd_assert(sp != NULL, return -EINVAL); if (snd_BUG_ON(!sp))
return -EINVAL;
if (sp->v.size == 0) if (sp->v.size == 0)
return 0; return 0;
......
...@@ -198,7 +198,8 @@ static int snd_sb_csp_ioctl(struct snd_hwdep * hw, struct file *file, unsigned i ...@@ -198,7 +198,8 @@ static int snd_sb_csp_ioctl(struct snd_hwdep * hw, struct file *file, unsigned i
struct snd_sb_csp_start start_info; struct snd_sb_csp_start start_info;
int err; int err;
snd_assert(p != NULL, return -EINVAL); if (snd_BUG_ON(!p))
return -EINVAL;
if (snd_sb_csp_check_version(p)) if (snd_sb_csp_check_version(p))
return -ENODEV; return -ENODEV;
...@@ -1046,7 +1047,8 @@ static int snd_sb_qsound_build(struct snd_sb_csp * p) ...@@ -1046,7 +1047,8 @@ static int snd_sb_qsound_build(struct snd_sb_csp * p)
struct snd_card *card; struct snd_card *card;
int err; int err;
snd_assert(p != NULL, return -EINVAL); if (snd_BUG_ON(!p))
return -EINVAL;
card = p->chip->card; card = p->chip->card;
p->qpos_left = p->qpos_right = SNDRV_SB_CSP_QSOUND_MAX_RIGHT / 2; p->qpos_left = p->qpos_right = SNDRV_SB_CSP_QSOUND_MAX_RIGHT / 2;
...@@ -1071,7 +1073,8 @@ static void snd_sb_qsound_destroy(struct snd_sb_csp * p) ...@@ -1071,7 +1073,8 @@ static void snd_sb_qsound_destroy(struct snd_sb_csp * p)
struct snd_card *card; struct snd_card *card;
unsigned long flags; unsigned long flags;
snd_assert(p != NULL, return); if (snd_BUG_ON(!p))
return;
card = p->chip->card; card = p->chip->card;
......
...@@ -669,7 +669,8 @@ static int snd_sb16_capture_close(struct snd_pcm_substream *substream) ...@@ -669,7 +669,8 @@ static int snd_sb16_capture_close(struct snd_pcm_substream *substream)
static int snd_sb16_set_dma_mode(struct snd_sb *chip, int what) static int snd_sb16_set_dma_mode(struct snd_sb *chip, int what)
{ {
if (chip->dma8 < 0 || chip->dma16 < 0) { if (chip->dma8 < 0 || chip->dma16 < 0) {
snd_assert(what == 0, return -EINVAL); if (snd_BUG_ON(what))
return -EINVAL;
return 0; return 0;
} }
if (what == 0) { if (what == 0) {
......
...@@ -111,7 +111,9 @@ static int snd_sb8_playback_prepare(struct snd_pcm_substream *substream) ...@@ -111,7 +111,9 @@ static int snd_sb8_playback_prepare(struct snd_pcm_substream *substream)
switch (chip->hardware) { switch (chip->hardware) {
case SB_HW_PRO: case SB_HW_PRO:
if (runtime->channels > 1) { if (runtime->channels > 1) {
snd_assert(rate == SB8_RATE(11025) || rate == SB8_RATE(22050), return -EINVAL); if (snd_BUG_ON(rate != SB8_RATE(11025) &&
rate != SB8_RATE(22050)))
return -EINVAL;
chip->playback_format = SB_DSP_HI_OUTPUT_AUTO; chip->playback_format = SB_DSP_HI_OUTPUT_AUTO;
break; break;
} }
...@@ -237,7 +239,9 @@ static int snd_sb8_capture_prepare(struct snd_pcm_substream *substream) ...@@ -237,7 +239,9 @@ static int snd_sb8_capture_prepare(struct snd_pcm_substream *substream)
switch (chip->hardware) { switch (chip->hardware) {
case SB_HW_PRO: case SB_HW_PRO:
if (runtime->channels > 1) { if (runtime->channels > 1) {
snd_assert(rate == SB8_RATE(11025) || rate == SB8_RATE(22050), return -EINVAL); if (snd_BUG_ON(rate != SB8_RATE(11025) &&
rate != SB8_RATE(22050)))
return -EINVAL;
chip->capture_format = SB_DSP_HI_INPUT_AUTO; chip->capture_format = SB_DSP_HI_INPUT_AUTO;
break; break;
} }
......
...@@ -219,7 +219,8 @@ int snd_sbdsp_create(struct snd_card *card, ...@@ -219,7 +219,8 @@ int snd_sbdsp_create(struct snd_card *card,
.dev_free = snd_sbdsp_dev_free, .dev_free = snd_sbdsp_dev_free,
}; };
snd_assert(r_chip != NULL, return -EINVAL); if (snd_BUG_ON(!r_chip))
return -EINVAL;
*r_chip = NULL; *r_chip = NULL;
chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = kzalloc(sizeof(*chip), GFP_KERNEL);
if (chip == NULL) if (chip == NULL)
......
...@@ -792,7 +792,8 @@ int snd_sbmixer_new(struct snd_sb *chip) ...@@ -792,7 +792,8 @@ int snd_sbmixer_new(struct snd_sb *chip)
struct snd_card *card; struct snd_card *card;
int err; int err;
snd_assert(chip != NULL && chip->card != NULL, return -EINVAL); if (snd_BUG_ON(!chip || !chip->card))
return -EINVAL;
card = chip->card; card = chip->card;
...@@ -925,7 +926,8 @@ static unsigned char als4000_saved_regs[] = { ...@@ -925,7 +926,8 @@ static unsigned char als4000_saved_regs[] = {
static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)
{ {
unsigned char *val = chip->saved_regs; unsigned char *val = chip->saved_regs;
snd_assert(num_regs <= ARRAY_SIZE(chip->saved_regs), return); if (snd_BUG_ON(num_regs > ARRAY_SIZE(chip->saved_regs)))
return;
for (; num_regs; num_regs--) for (; num_regs; num_regs--)
*val++ = snd_sbmixer_read(chip, *regs++); *val++ = snd_sbmixer_read(chip, *regs++);
} }
...@@ -933,7 +935,8 @@ static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) ...@@ -933,7 +935,8 @@ static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)
static void restore_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) static void restore_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)
{ {
unsigned char *val = chip->saved_regs; unsigned char *val = chip->saved_regs;
snd_assert(num_regs <= ARRAY_SIZE(chip->saved_regs), return); if (snd_BUG_ON(num_regs > ARRAY_SIZE(chip->saved_regs)))
return;
for (; num_regs; num_regs--) for (; num_regs; num_regs--)
snd_sbmixer_write(chip, *regs++, *val++); snd_sbmixer_write(chip, *regs++, *val++);
} }
......
...@@ -180,11 +180,11 @@ snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct file *file, ...@@ -180,11 +180,11 @@ snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct file *file,
unsigned short *pd; unsigned short *pd;
int err = 0; int err = 0;
snd_assert(sdev->card != NULL, return -ENODEV);
card = sdev->card; card = sdev->card;
if (snd_BUG_ON(!card))
snd_assert(card->private_data != NULL, return -ENODEV); return -ENODEV;
if (snd_BUG_ON(!card->private_data))
return -ENODEV;
acard = card->private_data; acard = card->private_data;
dev = &acard->wavefront; dev = &acard->wavefront;
......
...@@ -235,8 +235,10 @@ static int snd_wavefront_midi_input_open(struct snd_rawmidi_substream *substream ...@@ -235,8 +235,10 @@ static int snd_wavefront_midi_input_open(struct snd_rawmidi_substream *substream
snd_wavefront_midi_t *midi; snd_wavefront_midi_t *midi;
snd_wavefront_mpu_id mpu; snd_wavefront_mpu_id mpu;
snd_assert(substream != NULL && substream->rmidi != NULL, return -EIO); if (snd_BUG_ON(!substream || !substream->rmidi))
snd_assert(substream->rmidi->private_data != NULL, return -EIO); return -ENXIO;
if (snd_BUG_ON(!substream->rmidi->private_data))
return -ENXIO;
mpu = *((snd_wavefront_mpu_id *) substream->rmidi->private_data); mpu = *((snd_wavefront_mpu_id *) substream->rmidi->private_data);
...@@ -257,8 +259,10 @@ static int snd_wavefront_midi_output_open(struct snd_rawmidi_substream *substrea ...@@ -257,8 +259,10 @@ static int snd_wavefront_midi_output_open(struct snd_rawmidi_substream *substrea
snd_wavefront_midi_t *midi; snd_wavefront_midi_t *midi;
snd_wavefront_mpu_id mpu; snd_wavefront_mpu_id mpu;
snd_assert(substream != NULL && substream->rmidi != NULL, return -EIO); if (snd_BUG_ON(!substream || !substream->rmidi))
snd_assert(substream->rmidi->private_data != NULL, return -EIO); return -ENXIO;
if (snd_BUG_ON(!substream->rmidi->private_data))
return -ENXIO;
mpu = *((snd_wavefront_mpu_id *) substream->rmidi->private_data); mpu = *((snd_wavefront_mpu_id *) substream->rmidi->private_data);
...@@ -279,8 +283,10 @@ static int snd_wavefront_midi_input_close(struct snd_rawmidi_substream *substrea ...@@ -279,8 +283,10 @@ static int snd_wavefront_midi_input_close(struct snd_rawmidi_substream *substrea
snd_wavefront_midi_t *midi; snd_wavefront_midi_t *midi;
snd_wavefront_mpu_id mpu; snd_wavefront_mpu_id mpu;
snd_assert(substream != NULL && substream->rmidi != NULL, return -EIO); if (snd_BUG_ON(!substream || !substream->rmidi))
snd_assert(substream->rmidi->private_data != NULL, return -EIO); return -ENXIO;
if (snd_BUG_ON(!substream->rmidi->private_data))
return -ENXIO;
mpu = *((snd_wavefront_mpu_id *) substream->rmidi->private_data); mpu = *((snd_wavefront_mpu_id *) substream->rmidi->private_data);
...@@ -300,8 +306,10 @@ static int snd_wavefront_midi_output_close(struct snd_rawmidi_substream *substre ...@@ -300,8 +306,10 @@ static int snd_wavefront_midi_output_close(struct snd_rawmidi_substream *substre
snd_wavefront_midi_t *midi; snd_wavefront_midi_t *midi;
snd_wavefront_mpu_id mpu; snd_wavefront_mpu_id mpu;
snd_assert(substream != NULL && substream->rmidi != NULL, return -EIO); if (snd_BUG_ON(!substream || !substream->rmidi))
snd_assert(substream->rmidi->private_data != NULL, return -EIO); return -ENXIO;
if (snd_BUG_ON(!substream->rmidi->private_data))
return -ENXIO;
mpu = *((snd_wavefront_mpu_id *) substream->rmidi->private_data); mpu = *((snd_wavefront_mpu_id *) substream->rmidi->private_data);
......
...@@ -1648,9 +1648,10 @@ snd_wavefront_synth_ioctl (struct snd_hwdep *hw, struct file *file, ...@@ -1648,9 +1648,10 @@ snd_wavefront_synth_ioctl (struct snd_hwdep *hw, struct file *file,
card = (struct snd_card *) hw->card; card = (struct snd_card *) hw->card;
snd_assert(card != NULL, return -ENODEV); if (snd_BUG_ON(!card))
return -ENODEV;
snd_assert(card->private_data != NULL, return -ENODEV); if (snd_BUG_ON(!card->private_data))
return -ENODEV;
acard = card->private_data; acard = card->private_data;
dev = &acard->wavefront; dev = &acard->wavefront;
......
...@@ -1946,7 +1946,8 @@ static int snd_wss_info_mux(struct snd_kcontrol *kcontrol, ...@@ -1946,7 +1946,8 @@ static int snd_wss_info_mux(struct snd_kcontrol *kcontrol,
char **ptexts = texts; char **ptexts = texts;
struct snd_wss *chip = snd_kcontrol_chip(kcontrol); struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
snd_assert(chip->card != NULL, return -EINVAL); if (snd_BUG_ON(!chip->card))
return -EINVAL;
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 2; uinfo->count = 2;
uinfo->value.enumerated.items = 4; uinfo->value.enumerated.items = 4;
...@@ -2262,7 +2263,8 @@ int snd_wss_mixer(struct snd_wss *chip) ...@@ -2262,7 +2263,8 @@ int snd_wss_mixer(struct snd_wss *chip)
unsigned int idx; unsigned int idx;
int err; int err;
snd_assert(chip != NULL && chip->pcm != NULL, return -EINVAL); if (snd_BUG_ON(!chip || !chip->pcm))
return -EINVAL;
card = chip->card; card = chip->card;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment