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>
This commit is contained in:

committed by
Jaroslav Kysela

parent
da3cec35dd
commit
5e246b850d
@@ -99,7 +99,8 @@ static struct vx_cmd_info vx_dsp_cmds[] = {
|
||||
*/
|
||||
void vx_init_rmh(struct vx_rmh *rmh, unsigned int cmd)
|
||||
{
|
||||
snd_assert(cmd < CMD_LAST_INDEX, return);
|
||||
if (snd_BUG_ON(cmd >= CMD_LAST_INDEX))
|
||||
return;
|
||||
rmh->LgCmd = vx_dsp_cmds[cmd].length;
|
||||
rmh->LgStat = vx_dsp_cmds[cmd].st_length;
|
||||
rmh->DspStat = vx_dsp_cmds[cmd].st_type;
|
||||
|
@@ -205,7 +205,8 @@ static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh)
|
||||
|
||||
if (size < 1)
|
||||
return 0;
|
||||
snd_assert(size <= SIZE_MAX_STATUS, return -EINVAL);
|
||||
if (snd_BUG_ON(size > SIZE_MAX_STATUS))
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 1; i <= size; i++) {
|
||||
/* trigger an irq MESS_WRITE_NEXT */
|
||||
@@ -425,13 +426,16 @@ int snd_vx_load_boot_image(struct vx_core *chip, const struct firmware *boot)
|
||||
int no_fillup = vx_has_new_dsp(chip);
|
||||
|
||||
/* check the length of boot image */
|
||||
snd_assert(boot->size > 0, return -EINVAL);
|
||||
snd_assert(boot->size % 3 == 0, return -EINVAL);
|
||||
if (boot->size <= 0)
|
||||
return -EINVAL;
|
||||
if (boot->size % 3)
|
||||
return -EINVAL;
|
||||
#if 0
|
||||
{
|
||||
/* more strict check */
|
||||
unsigned int c = ((u32)boot->data[0] << 16) | ((u32)boot->data[1] << 8) | boot->data[2];
|
||||
snd_assert(boot->size == (c + 2) * 3, return -EINVAL);
|
||||
if (boot->size != (c + 2) * 3)
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -554,7 +558,8 @@ EXPORT_SYMBOL(snd_vx_irq_handler);
|
||||
*/
|
||||
static void vx_reset_board(struct vx_core *chip, int cold_reset)
|
||||
{
|
||||
snd_assert(chip->ops->reset_board, return);
|
||||
if (snd_BUG_ON(!chip->ops->reset_board))
|
||||
return;
|
||||
|
||||
/* current source, later sync'ed with target */
|
||||
chip->audio_source = VX_AUDIO_SRC_LINE;
|
||||
@@ -673,7 +678,8 @@ int snd_vx_dsp_load(struct vx_core *chip, const struct firmware *dsp)
|
||||
unsigned int csum = 0;
|
||||
const unsigned char *image, *cptr;
|
||||
|
||||
snd_assert(dsp->size % 3 == 0, return -EINVAL);
|
||||
if (dsp->size % 3)
|
||||
return -EINVAL;
|
||||
|
||||
vx_toggle_dac_mute(chip, 1);
|
||||
|
||||
@@ -775,7 +781,8 @@ struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw,
|
||||
{
|
||||
struct vx_core *chip;
|
||||
|
||||
snd_assert(card && hw && ops, return NULL);
|
||||
if (snd_BUG_ON(!card || !hw || !ops))
|
||||
return NULL;
|
||||
|
||||
chip = kzalloc(sizeof(*chip) + extra_size, GFP_KERNEL);
|
||||
if (! chip) {
|
||||
|
@@ -141,7 +141,8 @@ static int vx_hwdep_dsp_status(struct snd_hwdep *hw,
|
||||
};
|
||||
struct vx_core *vx = hw->private_data;
|
||||
|
||||
snd_assert(type_ids[vx->type], return -EINVAL);
|
||||
if (snd_BUG_ON(!type_ids[vx->type]))
|
||||
return -EINVAL;
|
||||
strcpy(info->id, type_ids[vx->type]);
|
||||
if (vx_is_pcmcia(vx))
|
||||
info->num_dsps = 4;
|
||||
@@ -168,7 +169,8 @@ static int vx_hwdep_dsp_load(struct snd_hwdep *hw,
|
||||
int index, err;
|
||||
struct firmware *fw;
|
||||
|
||||
snd_assert(vx->ops->load_dsp, return -ENXIO);
|
||||
if (snd_BUG_ON(!vx->ops->load_dsp))
|
||||
return -ENXIO;
|
||||
|
||||
fw = kmalloc(sizeof(*fw), GFP_KERNEL);
|
||||
if (! fw) {
|
||||
|
@@ -34,7 +34,8 @@ static void vx_write_codec_reg(struct vx_core *chip, int codec, unsigned int dat
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
snd_assert(chip->ops->write_codec, return);
|
||||
if (snd_BUG_ON(!chip->ops->write_codec))
|
||||
return;
|
||||
|
||||
if (chip->chip_status & VX_STAT_IS_STALE)
|
||||
return;
|
||||
|
@@ -587,7 +587,8 @@ static int vx_pcm_playback_open(struct snd_pcm_substream *subs)
|
||||
return -EBUSY;
|
||||
|
||||
audio = subs->pcm->device * 2;
|
||||
snd_assert(audio < chip->audio_outs, return -EINVAL);
|
||||
if (snd_BUG_ON(audio >= chip->audio_outs))
|
||||
return -EINVAL;
|
||||
|
||||
/* playback pipe may have been already allocated for monitoring */
|
||||
pipe = chip->playback_pipes[audio];
|
||||
@@ -996,7 +997,8 @@ static int vx_pcm_capture_open(struct snd_pcm_substream *subs)
|
||||
return -EBUSY;
|
||||
|
||||
audio = subs->pcm->device * 2;
|
||||
snd_assert(audio < chip->audio_ins, return -EINVAL);
|
||||
if (snd_BUG_ON(audio >= chip->audio_ins))
|
||||
return -EINVAL;
|
||||
err = vx_alloc_pipe(chip, 1, audio, 2, &pipe);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@@ -1214,7 +1216,8 @@ void vx_pcm_update_intr(struct vx_core *chip, unsigned int events)
|
||||
}
|
||||
if (capture)
|
||||
continue;
|
||||
snd_assert(p >= 0 && (unsigned int)p < chip->audio_outs,);
|
||||
if (snd_BUG_ON(p < 0 || p >= chip->audio_outs))
|
||||
continue;
|
||||
pipe = chip->playback_pipes[p];
|
||||
if (pipe && pipe->substream) {
|
||||
vx_pcm_playback_update(chip, pipe->substream, pipe);
|
||||
|
@@ -163,13 +163,15 @@ static int vx_calc_clock_from_freq(struct vx_core *chip, int freq)
|
||||
{
|
||||
int hexfreq;
|
||||
|
||||
snd_assert(freq > 0, return 0);
|
||||
if (snd_BUG_ON(freq <= 0))
|
||||
return 0;
|
||||
|
||||
hexfreq = (28224000 * 10) / freq;
|
||||
hexfreq = (hexfreq + 5) / 10;
|
||||
|
||||
/* max freq = 55125 Hz */
|
||||
snd_assert(hexfreq > 0x00000200, return 0);
|
||||
if (snd_BUG_ON(hexfreq <= 0x00000200))
|
||||
return 0;
|
||||
|
||||
if (hexfreq <= 0x03ff)
|
||||
return hexfreq - 0x00000201;
|
||||
|
Reference in New Issue
Block a user