aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/rme9652/rme9652.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/rme9652/rme9652.c')
-rw-r--r--sound/pci/rme9652/rme9652.c23
1 files changed, 14 insertions, 9 deletions
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;