aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/rme9652/hdsp.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/hdsp.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/hdsp.c')
-rw-r--r--sound/pci/rme9652/hdsp.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 4d6fbb36ab8a..d723543beadd 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -1036,7 +1036,7 @@ static void hdsp_set_dds_value(struct hdsp *hdsp, int rate)
1036 n = DDS_NUMERATOR; 1036 n = DDS_NUMERATOR;
1037 div64_32(&n, rate, &r); 1037 div64_32(&n, rate, &r);
1038 /* n should be less than 2^32 for being written to FREQ register */ 1038 /* n should be less than 2^32 for being written to FREQ register */
1039 snd_assert((n >> 32) == 0); 1039 snd_BUG_ON(n >> 32);
1040 /* HDSP_freqReg and HDSP_resetPointer are the same, so keep the DDS 1040 /* HDSP_freqReg and HDSP_resetPointer are the same, so keep the DDS
1041 value to write it after a reset */ 1041 value to write it after a reset */
1042 hdsp->dds_value = n; 1042 hdsp->dds_value = n;
@@ -3043,7 +3043,7 @@ static int snd_hdsp_get_adat_sync_check(struct snd_kcontrol *kcontrol, struct sn
3043 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 3043 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
3044 3044
3045 offset = ucontrol->id.index - 1; 3045 offset = ucontrol->id.index - 1;
3046 snd_assert(offset >= 0); 3046 snd_BUG_ON(offset < 0);
3047 3047
3048 switch (hdsp->io_type) { 3048 switch (hdsp->io_type) {
3049 case Digiface: 3049 case Digiface:
@@ -3767,7 +3767,8 @@ static char *hdsp_channel_buffer_location(struct hdsp *hdsp,
3767{ 3767{
3768 int mapped_channel; 3768 int mapped_channel;
3769 3769
3770 snd_assert(channel >= 0 && channel < hdsp->max_channels, return NULL); 3770 if (snd_BUG_ON(channel < 0 || channel >= hdsp->max_channels))
3771 return NULL;
3771 3772
3772 if ((mapped_channel = hdsp->channel_map[channel]) < 0) 3773 if ((mapped_channel = hdsp->channel_map[channel]) < 0)
3773 return NULL; 3774 return NULL;
@@ -3784,10 +3785,12 @@ static int snd_hdsp_playback_copy(struct snd_pcm_substream *substream, int chann
3784 struct hdsp *hdsp = snd_pcm_substream_chip(substream); 3785 struct hdsp *hdsp = snd_pcm_substream_chip(substream);
3785 char *channel_buf; 3786 char *channel_buf;
3786 3787
3787 snd_assert(pos + count <= HDSP_CHANNEL_BUFFER_BYTES / 4, return -EINVAL); 3788 if (snd_BUG_ON(pos + count > HDSP_CHANNEL_BUFFER_BYTES / 4))
3789 return -EINVAL;
3788 3790
3789 channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel); 3791 channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel);
3790 snd_assert(channel_buf != NULL, return -EIO); 3792 if (snd_BUG_ON(!channel_buf))
3793 return -EIO;
3791 if (copy_from_user(channel_buf + pos * 4, src, count * 4)) 3794 if (copy_from_user(channel_buf + pos * 4, src, count * 4))
3792 return -EFAULT; 3795 return -EFAULT;
3793 return count; 3796 return count;
@@ -3799,10 +3802,12 @@ static int snd_hdsp_capture_copy(struct snd_pcm_substream *substream, int channe
3799 struct hdsp *hdsp = snd_pcm_substream_chip(substream); 3802 struct hdsp *hdsp = snd_pcm_substream_chip(substream);
3800 char *channel_buf; 3803 char *channel_buf;
3801 3804
3802 snd_assert(pos + count <= HDSP_CHANNEL_BUFFER_BYTES / 4, return -EINVAL); 3805 if (snd_BUG_ON(pos + count > HDSP_CHANNEL_BUFFER_BYTES / 4))
3806 return -EINVAL;
3803 3807
3804 channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel); 3808 channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel);
3805 snd_assert(channel_buf != NULL, return -EIO); 3809 if (snd_BUG_ON(!channel_buf))
3810 return -EIO;
3806 if (copy_to_user(dst, channel_buf + pos * 4, count * 4)) 3811 if (copy_to_user(dst, channel_buf + pos * 4, count * 4))
3807 return -EFAULT; 3812 return -EFAULT;
3808 return count; 3813 return count;
@@ -3815,7 +3820,8 @@ static int snd_hdsp_hw_silence(struct snd_pcm_substream *substream, int channel,
3815 char *channel_buf; 3820 char *channel_buf;
3816 3821
3817 channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel); 3822 channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel);
3818 snd_assert(channel_buf != NULL, return -EIO); 3823 if (snd_BUG_ON(!channel_buf))
3824 return -EIO;
3819 memset(channel_buf + pos * 4, 0, count * 4); 3825 memset(channel_buf + pos * 4, 0, count * 4);
3820 return count; 3826 return count;
3821} 3827}
@@ -3927,7 +3933,8 @@ static int snd_hdsp_channel_info(struct snd_pcm_substream *substream,
3927 struct hdsp *hdsp = snd_pcm_substream_chip(substream); 3933 struct hdsp *hdsp = snd_pcm_substream_chip(substream);
3928 int mapped_channel; 3934 int mapped_channel;
3929 3935
3930 snd_assert(info->channel < hdsp->max_channels, return -EINVAL); 3936 if (snd_BUG_ON(info->channel >= hdsp->max_channels))
3937 return -EINVAL;
3931 3938
3932 if ((mapped_channel = hdsp->channel_map[info->channel]) < 0) 3939 if ((mapped_channel = hdsp->channel_map[info->channel]) < 0)
3933 return -EINVAL; 3940 return -EINVAL;