diff options
Diffstat (limited to 'sound/pci/rme9652')
-rw-r--r-- | sound/pci/rme9652/hdsp.c | 25 | ||||
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 52 | ||||
-rw-r--r-- | sound/pci/rme9652/rme9652.c | 23 |
3 files changed, 57 insertions, 43 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..98762f909d64 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -535,7 +535,8 @@ static inline void snd_hdspm_initialize_midi_flush(struct hdspm * hdspm); | |||
535 | static int hdspm_update_simple_mixer_controls(struct hdspm * hdspm); | 535 | static int hdspm_update_simple_mixer_controls(struct hdspm * hdspm); |
536 | static int hdspm_autosync_ref(struct hdspm * hdspm); | 536 | static int hdspm_autosync_ref(struct hdspm * hdspm); |
537 | static int snd_hdspm_set_defaults(struct hdspm * hdspm); | 537 | static int snd_hdspm_set_defaults(struct hdspm * hdspm); |
538 | static void hdspm_set_sgbuf(struct hdspm * hdspm, struct snd_sg_buf *sgbuf, | 538 | static void hdspm_set_sgbuf(struct hdspm * hdspm, |
539 | struct snd_pcm_substream *substream, | ||
539 | unsigned int reg, int channels); | 540 | unsigned int reg, int channels); |
540 | 541 | ||
541 | static inline int HDSPM_bit2freq(int n) | 542 | static inline int HDSPM_bit2freq(int n) |
@@ -845,7 +846,7 @@ static void hdspm_set_dds_value(struct hdspm *hdspm, int rate) | |||
845 | n = 110100480000000ULL; /* Value checked for AES32 and MADI */ | 846 | n = 110100480000000ULL; /* Value checked for AES32 and MADI */ |
846 | div64_32(&n, rate, &r); | 847 | div64_32(&n, rate, &r); |
847 | /* n should be less than 2^32 for being written to FREQ register */ | 848 | /* n should be less than 2^32 for being written to FREQ register */ |
848 | snd_assert((n >> 32) == 0); | 849 | snd_BUG_ON(n >> 32); |
849 | hdspm_write(hdspm, HDSPM_freqReg, (u32)n); | 850 | hdspm_write(hdspm, HDSPM_freqReg, (u32)n); |
850 | } | 851 | } |
851 | 852 | ||
@@ -2617,8 +2618,8 @@ static int snd_hdspm_get_playback_mixer(struct snd_kcontrol *kcontrol, | |||
2617 | 2618 | ||
2618 | channel = ucontrol->id.index - 1; | 2619 | channel = ucontrol->id.index - 1; |
2619 | 2620 | ||
2620 | snd_assert(channel >= 0 | 2621 | if (snd_BUG_ON(channel < 0 || channel >= HDSPM_MAX_CHANNELS)) |
2621 | || channel < HDSPM_MAX_CHANNELS, return -EINVAL); | 2622 | return -EINVAL; |
2622 | 2623 | ||
2623 | mapped_channel = hdspm->channel_map[channel]; | 2624 | mapped_channel = hdspm->channel_map[channel]; |
2624 | if (mapped_channel < 0) | 2625 | if (mapped_channel < 0) |
@@ -2652,8 +2653,8 @@ static int snd_hdspm_put_playback_mixer(struct snd_kcontrol *kcontrol, | |||
2652 | 2653 | ||
2653 | channel = ucontrol->id.index - 1; | 2654 | channel = ucontrol->id.index - 1; |
2654 | 2655 | ||
2655 | snd_assert(channel >= 0 | 2656 | if (snd_BUG_ON(channel < 0 || channel >= HDSPM_MAX_CHANNELS)) |
2656 | || channel < HDSPM_MAX_CHANNELS, return -EINVAL); | 2657 | return -EINVAL; |
2657 | 2658 | ||
2658 | mapped_channel = hdspm->channel_map[channel]; | 2659 | mapped_channel = hdspm->channel_map[channel]; |
2659 | if (mapped_channel < 0) | 2660 | if (mapped_channel < 0) |
@@ -3496,8 +3497,8 @@ static char *hdspm_channel_buffer_location(struct hdspm * hdspm, | |||
3496 | { | 3497 | { |
3497 | int mapped_channel; | 3498 | int mapped_channel; |
3498 | 3499 | ||
3499 | snd_assert(channel >= 0 | 3500 | if (snd_BUG_ON(channel < 0 || channel >= HDSPM_MAX_CHANNELS)) |
3500 | || channel < HDSPM_MAX_CHANNELS, return NULL); | 3501 | return NULL; |
3501 | 3502 | ||
3502 | mapped_channel = hdspm->channel_map[channel]; | 3503 | mapped_channel = hdspm->channel_map[channel]; |
3503 | if (mapped_channel < 0) | 3504 | if (mapped_channel < 0) |
@@ -3520,14 +3521,15 @@ static int snd_hdspm_playback_copy(struct snd_pcm_substream *substream, | |||
3520 | struct hdspm *hdspm = snd_pcm_substream_chip(substream); | 3521 | struct hdspm *hdspm = snd_pcm_substream_chip(substream); |
3521 | char *channel_buf; | 3522 | char *channel_buf; |
3522 | 3523 | ||
3523 | snd_assert(pos + count <= HDSPM_CHANNEL_BUFFER_BYTES / 4, | 3524 | if (snd_BUG_ON(pos + count > HDSPM_CHANNEL_BUFFER_BYTES / 4)) |
3524 | return -EINVAL); | 3525 | return -EINVAL; |
3525 | 3526 | ||
3526 | channel_buf = | 3527 | channel_buf = |
3527 | hdspm_channel_buffer_location(hdspm, substream->pstr->stream, | 3528 | hdspm_channel_buffer_location(hdspm, substream->pstr->stream, |
3528 | channel); | 3529 | channel); |
3529 | 3530 | ||
3530 | snd_assert(channel_buf != NULL, return -EIO); | 3531 | if (snd_BUG_ON(!channel_buf)) |
3532 | return -EIO; | ||
3531 | 3533 | ||
3532 | return copy_from_user(channel_buf + pos * 4, src, count * 4); | 3534 | return copy_from_user(channel_buf + pos * 4, src, count * 4); |
3533 | } | 3535 | } |
@@ -3539,13 +3541,14 @@ static int snd_hdspm_capture_copy(struct snd_pcm_substream *substream, | |||
3539 | struct hdspm *hdspm = snd_pcm_substream_chip(substream); | 3541 | struct hdspm *hdspm = snd_pcm_substream_chip(substream); |
3540 | char *channel_buf; | 3542 | char *channel_buf; |
3541 | 3543 | ||
3542 | snd_assert(pos + count <= HDSPM_CHANNEL_BUFFER_BYTES / 4, | 3544 | if (snd_BUG_ON(pos + count > HDSPM_CHANNEL_BUFFER_BYTES / 4)) |
3543 | return -EINVAL); | 3545 | return -EINVAL; |
3544 | 3546 | ||
3545 | channel_buf = | 3547 | channel_buf = |
3546 | hdspm_channel_buffer_location(hdspm, substream->pstr->stream, | 3548 | hdspm_channel_buffer_location(hdspm, substream->pstr->stream, |
3547 | channel); | 3549 | channel); |
3548 | snd_assert(channel_buf != NULL, return -EIO); | 3550 | if (snd_BUG_ON(!channel_buf)) |
3551 | return -EIO; | ||
3549 | return copy_to_user(dst, channel_buf + pos * 4, count * 4); | 3552 | return copy_to_user(dst, channel_buf + pos * 4, count * 4); |
3550 | } | 3553 | } |
3551 | 3554 | ||
@@ -3559,7 +3562,8 @@ static int snd_hdspm_hw_silence(struct snd_pcm_substream *substream, | |||
3559 | channel_buf = | 3562 | channel_buf = |
3560 | hdspm_channel_buffer_location(hdspm, substream->pstr->stream, | 3563 | hdspm_channel_buffer_location(hdspm, substream->pstr->stream, |
3561 | channel); | 3564 | channel); |
3562 | snd_assert(channel_buf != NULL, return -EIO); | 3565 | if (snd_BUG_ON(!channel_buf)) |
3566 | return -EIO; | ||
3563 | memset(channel_buf + pos * 4, 0, count * 4); | 3567 | memset(channel_buf + pos * 4, 0, count * 4); |
3564 | return 0; | 3568 | return 0; |
3565 | } | 3569 | } |
@@ -3601,8 +3605,6 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream, | |||
3601 | int i; | 3605 | int i; |
3602 | pid_t this_pid; | 3606 | pid_t this_pid; |
3603 | pid_t other_pid; | 3607 | pid_t other_pid; |
3604 | struct snd_sg_buf *sgbuf; | ||
3605 | |||
3606 | 3608 | ||
3607 | spin_lock_irq(&hdspm->lock); | 3609 | spin_lock_irq(&hdspm->lock); |
3608 | 3610 | ||
@@ -3670,11 +3672,9 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream, | |||
3670 | if (err < 0) | 3672 | if (err < 0) |
3671 | return err; | 3673 | return err; |
3672 | 3674 | ||
3673 | sgbuf = snd_pcm_substream_sgbuf(substream); | ||
3674 | |||
3675 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 3675 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
3676 | 3676 | ||
3677 | hdspm_set_sgbuf(hdspm, sgbuf, HDSPM_pageAddressBufferOut, | 3677 | hdspm_set_sgbuf(hdspm, substream, HDSPM_pageAddressBufferOut, |
3678 | params_channels(params)); | 3678 | params_channels(params)); |
3679 | 3679 | ||
3680 | for (i = 0; i < params_channels(params); ++i) | 3680 | for (i = 0; i < params_channels(params); ++i) |
@@ -3685,7 +3685,7 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream, | |||
3685 | snd_printdd("Allocated sample buffer for playback at %p\n", | 3685 | snd_printdd("Allocated sample buffer for playback at %p\n", |
3686 | hdspm->playback_buffer); | 3686 | hdspm->playback_buffer); |
3687 | } else { | 3687 | } else { |
3688 | hdspm_set_sgbuf(hdspm, sgbuf, HDSPM_pageAddressBufferIn, | 3688 | hdspm_set_sgbuf(hdspm, substream, HDSPM_pageAddressBufferIn, |
3689 | params_channels(params)); | 3689 | params_channels(params)); |
3690 | 3690 | ||
3691 | for (i = 0; i < params_channels(params); ++i) | 3691 | for (i = 0; i < params_channels(params); ++i) |
@@ -3700,7 +3700,7 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream, | |||
3700 | snd_printdd("Allocated sample buffer for %s at 0x%08X\n", | 3700 | snd_printdd("Allocated sample buffer for %s at 0x%08X\n", |
3701 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? | 3701 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? |
3702 | "playback" : "capture", | 3702 | "playback" : "capture", |
3703 | snd_pcm_sgbuf_get_addr(sgbuf, 0)); | 3703 | snd_pcm_sgbuf_get_addr(substream, 0)); |
3704 | */ | 3704 | */ |
3705 | /* | 3705 | /* |
3706 | snd_printdd("set_hwparams: %s %d Hz, %d channels, bs = %d\n", | 3706 | snd_printdd("set_hwparams: %s %d Hz, %d channels, bs = %d\n", |
@@ -3744,7 +3744,8 @@ static int snd_hdspm_channel_info(struct snd_pcm_substream *substream, | |||
3744 | struct hdspm *hdspm = snd_pcm_substream_chip(substream); | 3744 | struct hdspm *hdspm = snd_pcm_substream_chip(substream); |
3745 | int mapped_channel; | 3745 | int mapped_channel; |
3746 | 3746 | ||
3747 | snd_assert(info->channel < HDSPM_MAX_CHANNELS, return -EINVAL); | 3747 | if (snd_BUG_ON(info->channel >= HDSPM_MAX_CHANNELS)) |
3748 | return -EINVAL; | ||
3748 | 3749 | ||
3749 | mapped_channel = hdspm->channel_map[info->channel]; | 3750 | mapped_channel = hdspm->channel_map[info->channel]; |
3750 | if (mapped_channel < 0) | 3751 | if (mapped_channel < 0) |
@@ -4249,13 +4250,14 @@ static int __devinit snd_hdspm_preallocate_memory(struct hdspm * hdspm) | |||
4249 | return 0; | 4250 | return 0; |
4250 | } | 4251 | } |
4251 | 4252 | ||
4252 | static void hdspm_set_sgbuf(struct hdspm * hdspm, struct snd_sg_buf *sgbuf, | 4253 | static void hdspm_set_sgbuf(struct hdspm * hdspm, |
4254 | struct snd_pcm_substream *substream, | ||
4253 | unsigned int reg, int channels) | 4255 | unsigned int reg, int channels) |
4254 | { | 4256 | { |
4255 | int i; | 4257 | int i; |
4256 | for (i = 0; i < (channels * 16); i++) | 4258 | for (i = 0; i < (channels * 16); i++) |
4257 | hdspm_write(hdspm, reg + 4 * i, | 4259 | hdspm_write(hdspm, reg + 4 * i, |
4258 | snd_pcm_sgbuf_get_addr(sgbuf, (size_t) 4096 * i)); | 4260 | snd_pcm_sgbuf_get_addr(substream, 4096 * i)); |
4259 | } | 4261 | } |
4260 | 4262 | ||
4261 | /* ------------- ALSA Devices ---------------------------- */ | 4263 | /* ------------- ALSA Devices ---------------------------- */ |
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; |