diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-08-08 11:12:14 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-08-13 05:46:38 -0400 |
commit | da3cec35dd3c31d8706db4bf379372ce70d92118 (patch) | |
tree | 9379edebb1c7abc7a7a92ce3be30a35b77d9aa1d /sound/pci/rme9652 | |
parent | 622207dc31895b4e82c39100db8635d885c795e2 (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')
-rw-r--r-- | sound/pci/rme9652/hdsp.c | 25 | ||||
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 34 | ||||
-rw-r--r-- | sound/pci/rme9652/rme9652.c | 23 |
3 files changed, 49 insertions, 33 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; |
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) |
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index a123f0e6ba23..2570907134d7 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c | |||
@@ -595,8 +595,6 @@ static void rme9652_set_thru(struct snd_rme9652 *rme9652, int channel, int enabl | |||
595 | } else { | 595 | } else { |
596 | int mapped_channel; | 596 | int mapped_channel; |
597 | 597 | ||
598 | snd_assert(channel == RME9652_NCHANNELS, return); | ||
599 | |||
600 | mapped_channel = rme9652->channel_map[channel]; | 598 | mapped_channel = rme9652->channel_map[channel]; |
601 | 599 | ||
602 | if (enable) { | 600 | if (enable) { |
@@ -1893,7 +1891,8 @@ static char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652, | |||
1893 | { | 1891 | { |
1894 | int mapped_channel; | 1892 | int mapped_channel; |
1895 | 1893 | ||
1896 | snd_assert(channel >= 0 || channel < RME9652_NCHANNELS, return NULL); | 1894 | if (snd_BUG_ON(channel < 0 || channel >= RME9652_NCHANNELS)) |
1895 | return NULL; | ||
1897 | 1896 | ||
1898 | if ((mapped_channel = rme9652->channel_map[channel]) < 0) { | 1897 | if ((mapped_channel = rme9652->channel_map[channel]) < 0) { |
1899 | return NULL; | 1898 | return NULL; |
@@ -1914,12 +1913,14 @@ static int snd_rme9652_playback_copy(struct snd_pcm_substream *substream, int ch | |||
1914 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); | 1913 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); |
1915 | char *channel_buf; | 1914 | char *channel_buf; |
1916 | 1915 | ||
1917 | snd_assert(pos + count <= RME9652_CHANNEL_BUFFER_BYTES / 4, return -EINVAL); | 1916 | if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES / 4)) |
1917 | return -EINVAL; | ||
1918 | 1918 | ||
1919 | channel_buf = rme9652_channel_buffer_location (rme9652, | 1919 | channel_buf = rme9652_channel_buffer_location (rme9652, |
1920 | substream->pstr->stream, | 1920 | substream->pstr->stream, |
1921 | channel); | 1921 | channel); |
1922 | snd_assert(channel_buf != NULL, return -EIO); | 1922 | if (snd_BUG_ON(!channel_buf)) |
1923 | return -EIO; | ||
1923 | if (copy_from_user(channel_buf + pos * 4, src, count * 4)) | 1924 | if (copy_from_user(channel_buf + pos * 4, src, count * 4)) |
1924 | return -EFAULT; | 1925 | return -EFAULT; |
1925 | return count; | 1926 | return count; |
@@ -1931,12 +1932,14 @@ static int snd_rme9652_capture_copy(struct snd_pcm_substream *substream, int cha | |||
1931 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); | 1932 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); |
1932 | char *channel_buf; | 1933 | char *channel_buf; |
1933 | 1934 | ||
1934 | snd_assert(pos + count <= RME9652_CHANNEL_BUFFER_BYTES / 4, return -EINVAL); | 1935 | if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES / 4)) |
1936 | return -EINVAL; | ||
1935 | 1937 | ||
1936 | channel_buf = rme9652_channel_buffer_location (rme9652, | 1938 | channel_buf = rme9652_channel_buffer_location (rme9652, |
1937 | substream->pstr->stream, | 1939 | substream->pstr->stream, |
1938 | channel); | 1940 | channel); |
1939 | snd_assert(channel_buf != NULL, return -EIO); | 1941 | if (snd_BUG_ON(!channel_buf)) |
1942 | return -EIO; | ||
1940 | if (copy_to_user(dst, channel_buf + pos * 4, count * 4)) | 1943 | if (copy_to_user(dst, channel_buf + pos * 4, count * 4)) |
1941 | return -EFAULT; | 1944 | return -EFAULT; |
1942 | return count; | 1945 | return count; |
@@ -1951,7 +1954,8 @@ static int snd_rme9652_hw_silence(struct snd_pcm_substream *substream, int chann | |||
1951 | channel_buf = rme9652_channel_buffer_location (rme9652, | 1954 | channel_buf = rme9652_channel_buffer_location (rme9652, |
1952 | substream->pstr->stream, | 1955 | substream->pstr->stream, |
1953 | channel); | 1956 | channel); |
1954 | snd_assert(channel_buf != NULL, return -EIO); | 1957 | if (snd_BUG_ON(!channel_buf)) |
1958 | return -EIO; | ||
1955 | memset(channel_buf + pos * 4, 0, count * 4); | 1959 | memset(channel_buf + pos * 4, 0, count * 4); |
1956 | return count; | 1960 | return count; |
1957 | } | 1961 | } |
@@ -2053,7 +2057,8 @@ static int snd_rme9652_channel_info(struct snd_pcm_substream *substream, | |||
2053 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); | 2057 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); |
2054 | int chn; | 2058 | int chn; |
2055 | 2059 | ||
2056 | snd_assert(info->channel < RME9652_NCHANNELS, return -EINVAL); | 2060 | if (snd_BUG_ON(info->channel >= RME9652_NCHANNELS)) |
2061 | return -EINVAL; | ||
2057 | 2062 | ||
2058 | if ((chn = rme9652->channel_map[info->channel]) < 0) { | 2063 | if ((chn = rme9652->channel_map[info->channel]) < 0) { |
2059 | return -EINVAL; | 2064 | return -EINVAL; |