aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/rme9652/hdspm.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-08 11:12:14 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-13 05:46:38 -0400
commitda3cec35dd3c31d8706db4bf379372ce70d92118 (patch)
tree9379edebb1c7abc7a7a92ce3be30a35b77d9aa1d /sound/pci/rme9652/hdspm.c
parent622207dc31895b4e82c39100db8635d885c795e2 (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/rme9652/hdspm.c')
-rw-r--r--sound/pci/rme9652/hdspm.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index ab423bc82342..83c92e6082a2 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -845,7 +845,7 @@ static void hdspm_set_dds_value(struct hdspm *hdspm, int rate)
845 n = 110100480000000ULL; /* Value checked for AES32 and MADI */ 845 n = 110100480000000ULL; /* Value checked for AES32 and MADI */
846 div64_32(&n, rate, &r); 846 div64_32(&n, rate, &r);
847 /* n should be less than 2^32 for being written to FREQ register */ 847 /* n should be less than 2^32 for being written to FREQ register */
848 snd_assert((n >> 32) == 0); 848 snd_BUG_ON(n >> 32);
849 hdspm_write(hdspm, HDSPM_freqReg, (u32)n); 849 hdspm_write(hdspm, HDSPM_freqReg, (u32)n);
850} 850}
851 851
@@ -2617,8 +2617,8 @@ static int snd_hdspm_get_playback_mixer(struct snd_kcontrol *kcontrol,
2617 2617
2618 channel = ucontrol->id.index - 1; 2618 channel = ucontrol->id.index - 1;
2619 2619
2620 snd_assert(channel >= 0 2620 if (snd_BUG_ON(channel < 0 || channel >= HDSPM_MAX_CHANNELS))
2621 || channel < HDSPM_MAX_CHANNELS, return -EINVAL); 2621 return -EINVAL;
2622 2622
2623 mapped_channel = hdspm->channel_map[channel]; 2623 mapped_channel = hdspm->channel_map[channel];
2624 if (mapped_channel < 0) 2624 if (mapped_channel < 0)
@@ -2652,8 +2652,8 @@ static int snd_hdspm_put_playback_mixer(struct snd_kcontrol *kcontrol,
2652 2652
2653 channel = ucontrol->id.index - 1; 2653 channel = ucontrol->id.index - 1;
2654 2654
2655 snd_assert(channel >= 0 2655 if (snd_BUG_ON(channel < 0 || channel >= HDSPM_MAX_CHANNELS))
2656 || channel < HDSPM_MAX_CHANNELS, return -EINVAL); 2656 return -EINVAL;
2657 2657
2658 mapped_channel = hdspm->channel_map[channel]; 2658 mapped_channel = hdspm->channel_map[channel];
2659 if (mapped_channel < 0) 2659 if (mapped_channel < 0)
@@ -3496,8 +3496,8 @@ static char *hdspm_channel_buffer_location(struct hdspm * hdspm,
3496{ 3496{
3497 int mapped_channel; 3497 int mapped_channel;
3498 3498
3499 snd_assert(channel >= 0 3499 if (snd_BUG_ON(channel < 0 || channel >= HDSPM_MAX_CHANNELS))
3500 || channel < HDSPM_MAX_CHANNELS, return NULL); 3500 return NULL;
3501 3501
3502 mapped_channel = hdspm->channel_map[channel]; 3502 mapped_channel = hdspm->channel_map[channel];
3503 if (mapped_channel < 0) 3503 if (mapped_channel < 0)
@@ -3520,14 +3520,15 @@ static int snd_hdspm_playback_copy(struct snd_pcm_substream *substream,
3520 struct hdspm *hdspm = snd_pcm_substream_chip(substream); 3520 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
3521 char *channel_buf; 3521 char *channel_buf;
3522 3522
3523 snd_assert(pos + count <= HDSPM_CHANNEL_BUFFER_BYTES / 4, 3523 if (snd_BUG_ON(pos + count > HDSPM_CHANNEL_BUFFER_BYTES / 4))
3524 return -EINVAL); 3524 return -EINVAL;
3525 3525
3526 channel_buf = 3526 channel_buf =
3527 hdspm_channel_buffer_location(hdspm, substream->pstr->stream, 3527 hdspm_channel_buffer_location(hdspm, substream->pstr->stream,
3528 channel); 3528 channel);
3529 3529
3530 snd_assert(channel_buf != NULL, return -EIO); 3530 if (snd_BUG_ON(!channel_buf))
3531 return -EIO;
3531 3532
3532 return copy_from_user(channel_buf + pos * 4, src, count * 4); 3533 return copy_from_user(channel_buf + pos * 4, src, count * 4);
3533} 3534}
@@ -3539,13 +3540,14 @@ static int snd_hdspm_capture_copy(struct snd_pcm_substream *substream,
3539 struct hdspm *hdspm = snd_pcm_substream_chip(substream); 3540 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
3540 char *channel_buf; 3541 char *channel_buf;
3541 3542
3542 snd_assert(pos + count <= HDSPM_CHANNEL_BUFFER_BYTES / 4, 3543 if (snd_BUG_ON(pos + count > HDSPM_CHANNEL_BUFFER_BYTES / 4))
3543 return -EINVAL); 3544 return -EINVAL;
3544 3545
3545 channel_buf = 3546 channel_buf =
3546 hdspm_channel_buffer_location(hdspm, substream->pstr->stream, 3547 hdspm_channel_buffer_location(hdspm, substream->pstr->stream,
3547 channel); 3548 channel);
3548 snd_assert(channel_buf != NULL, return -EIO); 3549 if (snd_BUG_ON(!channel_buf))
3550 return -EIO;
3549 return copy_to_user(dst, channel_buf + pos * 4, count * 4); 3551 return copy_to_user(dst, channel_buf + pos * 4, count * 4);
3550} 3552}
3551 3553
@@ -3559,7 +3561,8 @@ static int snd_hdspm_hw_silence(struct snd_pcm_substream *substream,
3559 channel_buf = 3561 channel_buf =
3560 hdspm_channel_buffer_location(hdspm, substream->pstr->stream, 3562 hdspm_channel_buffer_location(hdspm, substream->pstr->stream,
3561 channel); 3563 channel);
3562 snd_assert(channel_buf != NULL, return -EIO); 3564 if (snd_BUG_ON(!channel_buf))
3565 return -EIO;
3563 memset(channel_buf + pos * 4, 0, count * 4); 3566 memset(channel_buf + pos * 4, 0, count * 4);
3564 return 0; 3567 return 0;
3565} 3568}
@@ -3744,7 +3747,8 @@ static int snd_hdspm_channel_info(struct snd_pcm_substream *substream,
3744 struct hdspm *hdspm = snd_pcm_substream_chip(substream); 3747 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
3745 int mapped_channel; 3748 int mapped_channel;
3746 3749
3747 snd_assert(info->channel < HDSPM_MAX_CHANNELS, return -EINVAL); 3750 if (snd_BUG_ON(info->channel >= HDSPM_MAX_CHANNELS))
3751 return -EINVAL;
3748 3752
3749 mapped_channel = hdspm->channel_map[info->channel]; 3753 mapped_channel = hdspm->channel_map[info->channel];
3750 if (mapped_channel < 0) 3754 if (mapped_channel < 0)