diff options
Diffstat (limited to 'sound/pci/echoaudio/echoaudio_dsp.c')
-rw-r--r-- | sound/pci/echoaudio/echoaudio_dsp.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c index e6c100770392..be0e18192de3 100644 --- a/sound/pci/echoaudio/echoaudio_dsp.c +++ b/sound/pci/echoaudio/echoaudio_dsp.c | |||
@@ -474,7 +474,8 @@ static int load_firmware(struct echoaudio *chip) | |||
474 | const struct firmware *fw; | 474 | const struct firmware *fw; |
475 | int box_type, err; | 475 | int box_type, err; |
476 | 476 | ||
477 | snd_assert(chip->dsp_code_to_load && chip->comm_page, return -EPERM); | 477 | if (snd_BUG_ON(!chip->dsp_code_to_load || !chip->comm_page)) |
478 | return -EPERM; | ||
478 | 479 | ||
479 | /* See if the ASIC is present and working - only if the DSP is already loaded */ | 480 | /* See if the ASIC is present and working - only if the DSP is already loaded */ |
480 | if (chip->dsp_code) { | 481 | if (chip->dsp_code) { |
@@ -512,8 +513,8 @@ static int load_firmware(struct echoaudio *chip) | |||
512 | /* Set the nominal level for an input or output bus (true = -10dBV, false = +4dBu) */ | 513 | /* Set the nominal level for an input or output bus (true = -10dBV, false = +4dBu) */ |
513 | static int set_nominal_level(struct echoaudio *chip, u16 index, char consumer) | 514 | static int set_nominal_level(struct echoaudio *chip, u16 index, char consumer) |
514 | { | 515 | { |
515 | snd_assert(index < num_busses_out(chip) + num_busses_in(chip), | 516 | if (snd_BUG_ON(index >= num_busses_out(chip) + num_busses_in(chip))) |
516 | return -EINVAL); | 517 | return -EINVAL; |
517 | 518 | ||
518 | /* Wait for the handshake (OK even if ASIC is not loaded) */ | 519 | /* Wait for the handshake (OK even if ASIC is not loaded) */ |
519 | if (wait_handshake(chip)) | 520 | if (wait_handshake(chip)) |
@@ -536,7 +537,8 @@ static int set_nominal_level(struct echoaudio *chip, u16 index, char consumer) | |||
536 | /* Set the gain for a single physical output channel (dB). */ | 537 | /* Set the gain for a single physical output channel (dB). */ |
537 | static int set_output_gain(struct echoaudio *chip, u16 channel, s8 gain) | 538 | static int set_output_gain(struct echoaudio *chip, u16 channel, s8 gain) |
538 | { | 539 | { |
539 | snd_assert(channel < num_busses_out(chip), return -EINVAL); | 540 | if (snd_BUG_ON(channel >= num_busses_out(chip))) |
541 | return -EINVAL; | ||
540 | 542 | ||
541 | if (wait_handshake(chip)) | 543 | if (wait_handshake(chip)) |
542 | return -EIO; | 544 | return -EIO; |
@@ -554,8 +556,9 @@ static int set_output_gain(struct echoaudio *chip, u16 channel, s8 gain) | |||
554 | static int set_monitor_gain(struct echoaudio *chip, u16 output, u16 input, | 556 | static int set_monitor_gain(struct echoaudio *chip, u16 output, u16 input, |
555 | s8 gain) | 557 | s8 gain) |
556 | { | 558 | { |
557 | snd_assert(output < num_busses_out(chip) && | 559 | if (snd_BUG_ON(output >= num_busses_out(chip) || |
558 | input < num_busses_in(chip), return -EINVAL); | 560 | input >= num_busses_in(chip))) |
561 | return -EINVAL; | ||
559 | 562 | ||
560 | if (wait_handshake(chip)) | 563 | if (wait_handshake(chip)) |
561 | return -EIO; | 564 | return -EIO; |
@@ -1065,8 +1068,10 @@ static int free_pipes(struct echoaudio *chip, struct audiopipe *pipe) | |||
1065 | int i; | 1068 | int i; |
1066 | 1069 | ||
1067 | DE_ACT(("free_pipes: Pipe %d\n", pipe->index)); | 1070 | DE_ACT(("free_pipes: Pipe %d\n", pipe->index)); |
1068 | snd_assert(is_pipe_allocated(chip, pipe->index), return -EINVAL); | 1071 | if (snd_BUG_ON(!is_pipe_allocated(chip, pipe->index))) |
1069 | snd_assert(pipe->state == PIPE_STATE_STOPPED, return -EINVAL); | 1072 | return -EINVAL; |
1073 | if (snd_BUG_ON(pipe->state != PIPE_STATE_STOPPED)) | ||
1074 | return -EINVAL; | ||
1070 | 1075 | ||
1071 | for (channel_mask = i = 0; i < pipe->interleave; i++) | 1076 | for (channel_mask = i = 0; i < pipe->interleave; i++) |
1072 | channel_mask |= 1 << (pipe->index + i); | 1077 | channel_mask |= 1 << (pipe->index + i); |