aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/echoaudio
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/echoaudio
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/echoaudio')
-rw-r--r--sound/pci/echoaudio/darla20_dsp.c3
-rw-r--r--sound/pci/echoaudio/darla24_dsp.c8
-rw-r--r--sound/pci/echoaudio/echo3g_dsp.c9
-rw-r--r--sound/pci/echoaudio/echoaudio.c8
-rw-r--r--sound/pci/echoaudio/echoaudio_3g.c11
-rw-r--r--sound/pci/echoaudio/echoaudio_dsp.c21
-rw-r--r--sound/pci/echoaudio/echoaudio_gml.c6
-rw-r--r--sound/pci/echoaudio/gina20_dsp.c6
-rw-r--r--sound/pci/echoaudio/gina24_dsp.c11
-rw-r--r--sound/pci/echoaudio/indigo_dsp.c8
-rw-r--r--sound/pci/echoaudio/indigodj_dsp.c8
-rw-r--r--sound/pci/echoaudio/indigoio_dsp.c8
-rw-r--r--sound/pci/echoaudio/layla20_dsp.c9
-rw-r--r--sound/pci/echoaudio/layla24_dsp.c11
-rw-r--r--sound/pci/echoaudio/mia_dsp.c13
-rw-r--r--sound/pci/echoaudio/midi.c6
-rw-r--r--sound/pci/echoaudio/mona_dsp.c6
17 files changed, 97 insertions, 55 deletions
diff --git a/sound/pci/echoaudio/darla20_dsp.c b/sound/pci/echoaudio/darla20_dsp.c
index 4159e3bc186f..29043301ebb8 100644
--- a/sound/pci/echoaudio/darla20_dsp.c
+++ b/sound/pci/echoaudio/darla20_dsp.c
@@ -34,7 +34,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
34 int err; 34 int err;
35 35
36 DE_INIT(("init_hw() - Darla20\n")); 36 DE_INIT(("init_hw() - Darla20\n"));
37 snd_assert((subdevice_id & 0xfff0) == DARLA20, return -ENODEV); 37 if (snd_BUG_ON((subdevice_id & 0xfff0) != DARLA20))
38 return -ENODEV;
38 39
39 if ((err = init_dsp_comm_page(chip))) { 40 if ((err = init_dsp_comm_page(chip))) {
40 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 41 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
diff --git a/sound/pci/echoaudio/darla24_dsp.c b/sound/pci/echoaudio/darla24_dsp.c
index 79938eed7e9c..60228731841f 100644
--- a/sound/pci/echoaudio/darla24_dsp.c
+++ b/sound/pci/echoaudio/darla24_dsp.c
@@ -34,7 +34,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
34 int err; 34 int err;
35 35
36 DE_INIT(("init_hw() - Darla24\n")); 36 DE_INIT(("init_hw() - Darla24\n"));
37 snd_assert((subdevice_id & 0xfff0) == DARLA24, return -ENODEV); 37 if (snd_BUG_ON((subdevice_id & 0xfff0) != DARLA24))
38 return -ENODEV;
38 39
39 if ((err = init_dsp_comm_page(chip))) { 40 if ((err = init_dsp_comm_page(chip))) {
40 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 41 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@@ -148,8 +149,9 @@ static int set_sample_rate(struct echoaudio *chip, u32 rate)
148 149
149static int set_input_clock(struct echoaudio *chip, u16 clock) 150static int set_input_clock(struct echoaudio *chip, u16 clock)
150{ 151{
151 snd_assert(clock == ECHO_CLOCK_INTERNAL || 152 if (snd_BUG_ON(clock != ECHO_CLOCK_INTERNAL &&
152 clock == ECHO_CLOCK_ESYNC, return -EINVAL); 153 clock != ECHO_CLOCK_ESYNC))
154 return -EINVAL;
153 chip->input_clock = clock; 155 chip->input_clock = clock;
154 return set_sample_rate(chip, chip->sample_rate); 156 return set_sample_rate(chip, chip->sample_rate);
155} 157}
diff --git a/sound/pci/echoaudio/echo3g_dsp.c b/sound/pci/echoaudio/echo3g_dsp.c
index 48eb7c599111..417e25add82b 100644
--- a/sound/pci/echoaudio/echo3g_dsp.c
+++ b/sound/pci/echoaudio/echo3g_dsp.c
@@ -47,7 +47,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
47 47
48 local_irq_enable(); 48 local_irq_enable();
49 DE_INIT(("init_hw() - Echo3G\n")); 49 DE_INIT(("init_hw() - Echo3G\n"));
50 snd_assert((subdevice_id & 0xfff0) == ECHO3G, return -ENODEV); 50 if (snd_BUG_ON((subdevice_id & 0xfff0) != ECHO3G))
51 return -ENODEV;
51 52
52 if ((err = init_dsp_comm_page(chip))) { 53 if ((err = init_dsp_comm_page(chip))) {
53 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 54 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@@ -104,9 +105,11 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
104 if ((err = init_line_levels(chip)) < 0) 105 if ((err = init_line_levels(chip)) < 0)
105 return err; 106 return err;
106 err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA); 107 err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA);
107 snd_assert(err >= 0, return err); 108 if (err < 0)
109 return err;
108 err = set_phantom_power(chip, 0); 110 err = set_phantom_power(chip, 0);
109 snd_assert(err >= 0, return err); 111 if (err < 0)
112 return err;
110 err = set_professional_spdif(chip, TRUE); 113 err = set_professional_spdif(chip, TRUE);
111 114
112 DE_INIT(("init_hw done\n")); 115 DE_INIT(("init_hw done\n"));
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index e16dc92e82fb..160d47054922 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -503,7 +503,7 @@ static int init_engine(struct snd_pcm_substream *substream,
503 if (pipe->index >= 0) { 503 if (pipe->index >= 0) {
504 DE_HWP(("hwp_ie free(%d)\n", pipe->index)); 504 DE_HWP(("hwp_ie free(%d)\n", pipe->index));
505 err = free_pipes(chip, pipe); 505 err = free_pipes(chip, pipe);
506 snd_assert(!err); 506 snd_BUG_ON(err);
507 chip->substream[pipe->index] = NULL; 507 chip->substream[pipe->index] = NULL;
508 } 508 }
509 509
@@ -690,8 +690,10 @@ static int pcm_prepare(struct snd_pcm_substream *substream)
690 return -EINVAL; 690 return -EINVAL;
691 } 691 }
692 692
693 snd_assert(pipe_index < px_num(chip), return -EINVAL); 693 if (snd_BUG_ON(pipe_index >= px_num(chip)))
694 snd_assert(is_pipe_allocated(chip, pipe_index), return -EINVAL); 694 return -EINVAL;
695 if (snd_BUG_ON(!is_pipe_allocated(chip, pipe_index)))
696 return -EINVAL;
695 set_audio_format(chip, pipe_index, &format); 697 set_audio_format(chip, pipe_index, &format);
696 return 0; 698 return 0;
697} 699}
diff --git a/sound/pci/echoaudio/echoaudio_3g.c b/sound/pci/echoaudio/echoaudio_3g.c
index 52a933189576..c3736bbd819e 100644
--- a/sound/pci/echoaudio/echoaudio_3g.c
+++ b/sound/pci/echoaudio/echoaudio_3g.c
@@ -103,9 +103,11 @@ static int set_digital_mode(struct echoaudio *chip, u8 mode)
103 int err, i, o; 103 int err, i, o;
104 104
105 /* All audio channels must be closed before changing the digital mode */ 105 /* All audio channels must be closed before changing the digital mode */
106 snd_assert(!chip->pipe_alloc_mask, return -EAGAIN); 106 if (snd_BUG_ON(chip->pipe_alloc_mask))
107 return -EAGAIN;
107 108
108 snd_assert(chip->digital_modes & (1 << mode), return -EINVAL); 109 if (snd_BUG_ON(!(chip->digital_modes & (1 << mode))))
110 return -EINVAL;
109 111
110 previous_mode = chip->digital_mode; 112 previous_mode = chip->digital_mode;
111 err = dsp_set_digital_mode(chip, mode); 113 err = dsp_set_digital_mode(chip, mode);
@@ -267,8 +269,9 @@ static int set_sample_rate(struct echoaudio *chip, u32 rate)
267 return 0; 269 return 0;
268 } 270 }
269 271
270 snd_assert(rate < 50000 || chip->digital_mode != DIGITAL_MODE_ADAT, 272 if (snd_BUG_ON(rate >= 50000 &&
271 return -EINVAL); 273 chip->digital_mode == DIGITAL_MODE_ADAT))
274 return -EINVAL;
272 275
273 clock = 0; 276 clock = 0;
274 control_reg = le32_to_cpu(chip->comm_page->control_register); 277 control_reg = le32_to_cpu(chip->comm_page->control_register);
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) */
513static int set_nominal_level(struct echoaudio *chip, u16 index, char consumer) 514static 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). */
537static int set_output_gain(struct echoaudio *chip, u16 channel, s8 gain) 538static 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)
554static int set_monitor_gain(struct echoaudio *chip, u16 output, u16 input, 556static 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);
diff --git a/sound/pci/echoaudio/echoaudio_gml.c b/sound/pci/echoaudio/echoaudio_gml.c
index 3aa37e76ebab..afa273330e8a 100644
--- a/sound/pci/echoaudio/echoaudio_gml.c
+++ b/sound/pci/echoaudio/echoaudio_gml.c
@@ -112,9 +112,11 @@ static int set_digital_mode(struct echoaudio *chip, u8 mode)
112 return -EIO; 112 return -EIO;
113 113
114 /* All audio channels must be closed before changing the digital mode */ 114 /* All audio channels must be closed before changing the digital mode */
115 snd_assert(!chip->pipe_alloc_mask, return -EAGAIN); 115 if (snd_BUG_ON(chip->pipe_alloc_mask))
116 return -EAGAIN;
116 117
117 snd_assert(chip->digital_modes & (1 << mode), return -EINVAL); 118 if (snd_BUG_ON(!(chip->digital_modes & (1 << mode))))
119 return -EINVAL;
118 120
119 previous_mode = chip->digital_mode; 121 previous_mode = chip->digital_mode;
120 err = dsp_set_digital_mode(chip, mode); 122 err = dsp_set_digital_mode(chip, mode);
diff --git a/sound/pci/echoaudio/gina20_dsp.c b/sound/pci/echoaudio/gina20_dsp.c
index 2757c8960843..db6c952e9d7f 100644
--- a/sound/pci/echoaudio/gina20_dsp.c
+++ b/sound/pci/echoaudio/gina20_dsp.c
@@ -38,7 +38,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
38 int err; 38 int err;
39 39
40 DE_INIT(("init_hw() - Gina20\n")); 40 DE_INIT(("init_hw() - Gina20\n"));
41 snd_assert((subdevice_id & 0xfff0) == GINA20, return -ENODEV); 41 if (snd_BUG_ON((subdevice_id & 0xfff0) != GINA20))
42 return -ENODEV;
42 43
43 if ((err = init_dsp_comm_page(chip))) { 44 if ((err = init_dsp_comm_page(chip))) {
44 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 45 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@@ -177,7 +178,8 @@ static int set_input_clock(struct echoaudio *chip, u16 clock)
177/* Set input bus gain (one unit is 0.5dB !) */ 178/* Set input bus gain (one unit is 0.5dB !) */
178static int set_input_gain(struct echoaudio *chip, u16 input, int gain) 179static int set_input_gain(struct echoaudio *chip, u16 input, int gain)
179{ 180{
180 snd_assert(input < num_busses_in(chip), return -EINVAL); 181 if (snd_BUG_ON(input >= num_busses_in(chip)))
182 return -EINVAL;
181 183
182 if (wait_handshake(chip)) 184 if (wait_handshake(chip))
183 return -EIO; 185 return -EIO;
diff --git a/sound/pci/echoaudio/gina24_dsp.c b/sound/pci/echoaudio/gina24_dsp.c
index 144fc567becf..2fef37a2a5b9 100644
--- a/sound/pci/echoaudio/gina24_dsp.c
+++ b/sound/pci/echoaudio/gina24_dsp.c
@@ -43,7 +43,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
43 int err; 43 int err;
44 44
45 DE_INIT(("init_hw() - Gina24\n")); 45 DE_INIT(("init_hw() - Gina24\n"));
46 snd_assert((subdevice_id & 0xfff0) == GINA24, return -ENODEV); 46 if (snd_BUG_ON((subdevice_id & 0xfff0) != GINA24))
47 return -ENODEV;
47 48
48 if ((err = init_dsp_comm_page(chip))) { 49 if ((err = init_dsp_comm_page(chip))) {
49 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 50 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@@ -84,7 +85,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
84 if ((err = init_line_levels(chip)) < 0) 85 if ((err = init_line_levels(chip)) < 0)
85 return err; 86 return err;
86 err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA); 87 err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA);
87 snd_assert(err >= 0, return err); 88 if (err < 0)
89 return err;
88 err = set_professional_spdif(chip, TRUE); 90 err = set_professional_spdif(chip, TRUE);
89 91
90 DE_INIT(("init_hw done\n")); 92 DE_INIT(("init_hw done\n"));
@@ -163,8 +165,9 @@ static int set_sample_rate(struct echoaudio *chip, u32 rate)
163{ 165{
164 u32 control_reg, clock; 166 u32 control_reg, clock;
165 167
166 snd_assert(rate < 50000 || chip->digital_mode != DIGITAL_MODE_ADAT, 168 if (snd_BUG_ON(rate >= 50000 &&
167 return -EINVAL); 169 chip->digital_mode == DIGITAL_MODE_ADAT))
170 return -EINVAL;
168 171
169 /* Only set the clock for internal mode. */ 172 /* Only set the clock for internal mode. */
170 if (chip->input_clock != ECHO_CLOCK_INTERNAL) { 173 if (chip->input_clock != ECHO_CLOCK_INTERNAL) {
diff --git a/sound/pci/echoaudio/indigo_dsp.c b/sound/pci/echoaudio/indigo_dsp.c
index d6ac7734609e..f05e39f7aad9 100644
--- a/sound/pci/echoaudio/indigo_dsp.c
+++ b/sound/pci/echoaudio/indigo_dsp.c
@@ -39,7 +39,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
39 int err; 39 int err;
40 40
41 DE_INIT(("init_hw() - Indigo\n")); 41 DE_INIT(("init_hw() - Indigo\n"));
42 snd_assert((subdevice_id & 0xfff0) == INDIGO, return -ENODEV); 42 if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO))
43 return -ENODEV;
43 44
44 if ((err = init_dsp_comm_page(chip))) { 45 if ((err = init_dsp_comm_page(chip))) {
45 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 46 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@@ -143,8 +144,9 @@ static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,
143{ 144{
144 int index; 145 int index;
145 146
146 snd_assert(pipe < num_pipes_out(chip) && 147 if (snd_BUG_ON(pipe >= num_pipes_out(chip) ||
147 output < num_busses_out(chip), return -EINVAL); 148 output >= num_busses_out(chip)))
149 return -EINVAL;
148 150
149 if (wait_handshake(chip)) 151 if (wait_handshake(chip))
150 return -EIO; 152 return -EIO;
diff --git a/sound/pci/echoaudio/indigodj_dsp.c b/sound/pci/echoaudio/indigodj_dsp.c
index 500e150b49fc..90730a5ecb42 100644
--- a/sound/pci/echoaudio/indigodj_dsp.c
+++ b/sound/pci/echoaudio/indigodj_dsp.c
@@ -39,7 +39,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
39 int err; 39 int err;
40 40
41 DE_INIT(("init_hw() - Indigo DJ\n")); 41 DE_INIT(("init_hw() - Indigo DJ\n"));
42 snd_assert((subdevice_id & 0xfff0) == INDIGO_DJ, return -ENODEV); 42 if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_DJ))
43 return -ENODEV;
43 44
44 if ((err = init_dsp_comm_page(chip))) { 45 if ((err = init_dsp_comm_page(chip))) {
45 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 46 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@@ -143,8 +144,9 @@ static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,
143{ 144{
144 int index; 145 int index;
145 146
146 snd_assert(pipe < num_pipes_out(chip) && 147 if (snd_BUG_ON(pipe >= num_pipes_out(chip) ||
147 output < num_busses_out(chip), return -EINVAL); 148 output >= num_busses_out(chip)))
149 return -EINVAL;
148 150
149 if (wait_handshake(chip)) 151 if (wait_handshake(chip))
150 return -EIO; 152 return -EIO;
diff --git a/sound/pci/echoaudio/indigoio_dsp.c b/sound/pci/echoaudio/indigoio_dsp.c
index f3ad13d06be0..a7e09ec21079 100644
--- a/sound/pci/echoaudio/indigoio_dsp.c
+++ b/sound/pci/echoaudio/indigoio_dsp.c
@@ -39,7 +39,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
39 int err; 39 int err;
40 40
41 DE_INIT(("init_hw() - Indigo IO\n")); 41 DE_INIT(("init_hw() - Indigo IO\n"));
42 snd_assert((subdevice_id & 0xfff0) == INDIGO_IO, return -ENODEV); 42 if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_IO))
43 return -ENODEV;
43 44
44 if ((err = init_dsp_comm_page(chip))) { 45 if ((err = init_dsp_comm_page(chip))) {
45 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 46 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@@ -114,8 +115,9 @@ static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,
114{ 115{
115 int index; 116 int index;
116 117
117 snd_assert(pipe < num_pipes_out(chip) && 118 if (snd_BUG_ON(pipe >= num_pipes_out(chip) ||
118 output < num_busses_out(chip), return -EINVAL); 119 output >= num_busses_out(chip)))
120 return -EINVAL;
119 121
120 if (wait_handshake(chip)) 122 if (wait_handshake(chip))
121 return -EIO; 123 return -EIO;
diff --git a/sound/pci/echoaudio/layla20_dsp.c b/sound/pci/echoaudio/layla20_dsp.c
index 990c9a60a0a8..ede75c6ca0fb 100644
--- a/sound/pci/echoaudio/layla20_dsp.c
+++ b/sound/pci/echoaudio/layla20_dsp.c
@@ -42,7 +42,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
42 int err; 42 int err;
43 43
44 DE_INIT(("init_hw() - Layla20\n")); 44 DE_INIT(("init_hw() - Layla20\n"));
45 snd_assert((subdevice_id & 0xfff0) == LAYLA20, return -ENODEV); 45 if (snd_BUG_ON((subdevice_id & 0xfff0) != LAYLA20))
46 return -ENODEV;
46 47
47 if ((err = init_dsp_comm_page(chip))) { 48 if ((err = init_dsp_comm_page(chip))) {
48 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 49 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@@ -155,7 +156,8 @@ static int load_asic(struct echoaudio *chip)
155 156
156static int set_sample_rate(struct echoaudio *chip, u32 rate) 157static int set_sample_rate(struct echoaudio *chip, u32 rate)
157{ 158{
158 snd_assert(rate >= 8000 && rate <= 50000, return -EINVAL); 159 if (snd_BUG_ON(rate < 8000 || rate > 50000))
160 return -EINVAL;
159 161
160 /* Only set the clock for internal mode. Do not return failure, 162 /* Only set the clock for internal mode. Do not return failure,
161 simply treat it as a non-event. */ 163 simply treat it as a non-event. */
@@ -252,7 +254,8 @@ static int set_output_clock(struct echoaudio *chip, u16 clock)
252/* Set input bus gain (one unit is 0.5dB !) */ 254/* Set input bus gain (one unit is 0.5dB !) */
253static int set_input_gain(struct echoaudio *chip, u16 input, int gain) 255static int set_input_gain(struct echoaudio *chip, u16 input, int gain)
254{ 256{
255 snd_assert(input < num_busses_in(chip), return -EINVAL); 257 if (snd_BUG_ON(input >= num_busses_in(chip)))
258 return -EINVAL;
256 259
257 if (wait_handshake(chip)) 260 if (wait_handshake(chip))
258 return -EIO; 261 return -EIO;
diff --git a/sound/pci/echoaudio/layla24_dsp.c b/sound/pci/echoaudio/layla24_dsp.c
index 97e42e115147..d61b5cbcccad 100644
--- a/sound/pci/echoaudio/layla24_dsp.c
+++ b/sound/pci/echoaudio/layla24_dsp.c
@@ -42,7 +42,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
42 int err; 42 int err;
43 43
44 DE_INIT(("init_hw() - Layla24\n")); 44 DE_INIT(("init_hw() - Layla24\n"));
45 snd_assert((subdevice_id & 0xfff0) == LAYLA24, return -ENODEV); 45 if (snd_BUG_ON((subdevice_id & 0xfff0) != LAYLA24))
46 return -ENODEV;
46 47
47 if ((err = init_dsp_comm_page(chip))) { 48 if ((err = init_dsp_comm_page(chip))) {
48 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 49 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@@ -73,7 +74,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
73 return err; 74 return err;
74 75
75 err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA); 76 err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA);
76 snd_assert(err >= 0, return err); 77 if (err < 0)
78 return err;
77 err = set_professional_spdif(chip, TRUE); 79 err = set_professional_spdif(chip, TRUE);
78 80
79 DE_INIT(("init_hw done\n")); 81 DE_INIT(("init_hw done\n"));
@@ -158,8 +160,9 @@ static int set_sample_rate(struct echoaudio *chip, u32 rate)
158{ 160{
159 u32 control_reg, clock, base_rate; 161 u32 control_reg, clock, base_rate;
160 162
161 snd_assert(rate < 50000 || chip->digital_mode != DIGITAL_MODE_ADAT, 163 if (snd_BUG_ON(rate >= 50000 &&
162 return -EINVAL); 164 chip->digital_mode == DIGITAL_MODE_ADAT))
165 return -EINVAL;
163 166
164 /* Only set the clock for internal mode. */ 167 /* Only set the clock for internal mode. */
165 if (chip->input_clock != ECHO_CLOCK_INTERNAL) { 168 if (chip->input_clock != ECHO_CLOCK_INTERNAL) {
diff --git a/sound/pci/echoaudio/mia_dsp.c b/sound/pci/echoaudio/mia_dsp.c
index 891c70519096..227386602f9b 100644
--- a/sound/pci/echoaudio/mia_dsp.c
+++ b/sound/pci/echoaudio/mia_dsp.c
@@ -42,7 +42,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
42 int err; 42 int err;
43 43
44 DE_INIT(("init_hw() - Mia\n")); 44 DE_INIT(("init_hw() - Mia\n"));
45 snd_assert((subdevice_id & 0xfff0) == MIA, return -ENODEV); 45 if (snd_BUG_ON((subdevice_id & 0xfff0) != MIA))
46 return -ENODEV;
46 47
47 if ((err = init_dsp_comm_page(chip))) { 48 if ((err = init_dsp_comm_page(chip))) {
48 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 49 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@@ -161,8 +162,9 @@ static int set_sample_rate(struct echoaudio *chip, u32 rate)
161static int set_input_clock(struct echoaudio *chip, u16 clock) 162static int set_input_clock(struct echoaudio *chip, u16 clock)
162{ 163{
163 DE_ACT(("set_input_clock(%d)\n", clock)); 164 DE_ACT(("set_input_clock(%d)\n", clock));
164 snd_assert(clock == ECHO_CLOCK_INTERNAL || clock == ECHO_CLOCK_SPDIF, 165 if (snd_BUG_ON(clock != ECHO_CLOCK_INTERNAL &&
165 return -EINVAL); 166 clock != ECHO_CLOCK_SPDIF))
167 return -EINVAL;
166 168
167 chip->input_clock = clock; 169 chip->input_clock = clock;
168 return set_sample_rate(chip, chip->sample_rate); 170 return set_sample_rate(chip, chip->sample_rate);
@@ -176,8 +178,9 @@ static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,
176{ 178{
177 int index; 179 int index;
178 180
179 snd_assert(pipe < num_pipes_out(chip) && 181 if (snd_BUG_ON(pipe >= num_pipes_out(chip) ||
180 output < num_busses_out(chip), return -EINVAL); 182 output >= num_busses_out(chip)))
183 return -EINVAL;
181 184
182 if (wait_handshake(chip)) 185 if (wait_handshake(chip))
183 return -EIO; 186 return -EIO;
diff --git a/sound/pci/echoaudio/midi.c b/sound/pci/echoaudio/midi.c
index 91f5bff66d3f..77bf2a83d997 100644
--- a/sound/pci/echoaudio/midi.c
+++ b/sound/pci/echoaudio/midi.c
@@ -59,7 +59,8 @@ static int enable_midi_input(struct echoaudio *chip, char enable)
59Returns how many actually written or < 0 on error */ 59Returns how many actually written or < 0 on error */
60static int write_midi(struct echoaudio *chip, u8 *data, int bytes) 60static int write_midi(struct echoaudio *chip, u8 *data, int bytes)
61{ 61{
62 snd_assert(bytes > 0 && bytes < MIDI_OUT_BUFFER_SIZE, return -EINVAL); 62 if (snd_BUG_ON(bytes <= 0 || bytes >= MIDI_OUT_BUFFER_SIZE))
63 return -EINVAL;
63 64
64 if (wait_handshake(chip)) 65 if (wait_handshake(chip))
65 return -EIO; 66 return -EIO;
@@ -119,7 +120,8 @@ static int midi_service_irq(struct echoaudio *chip)
119 /* The count is at index 0, followed by actual data */ 120 /* The count is at index 0, followed by actual data */
120 count = le16_to_cpu(chip->comm_page->midi_input[0]); 121 count = le16_to_cpu(chip->comm_page->midi_input[0]);
121 122
122 snd_assert(count < MIDI_IN_BUFFER_SIZE, return 0); 123 if (snd_BUG_ON(count >= MIDI_IN_BUFFER_SIZE))
124 return 0;
123 125
124 /* Get the MIDI data from the comm page */ 126 /* Get the MIDI data from the comm page */
125 i = 1; 127 i = 1;
diff --git a/sound/pci/echoaudio/mona_dsp.c b/sound/pci/echoaudio/mona_dsp.c
index c0b4bf0be7d1..eaa619bd2a03 100644
--- a/sound/pci/echoaudio/mona_dsp.c
+++ b/sound/pci/echoaudio/mona_dsp.c
@@ -43,7 +43,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
43 int err; 43 int err;
44 44
45 DE_INIT(("init_hw() - Mona\n")); 45 DE_INIT(("init_hw() - Mona\n"));
46 snd_assert((subdevice_id & 0xfff0) == MONA, return -ENODEV); 46 if (snd_BUG_ON((subdevice_id & 0xfff0) != MONA))
47 return -ENODEV;
47 48
48 if ((err = init_dsp_comm_page(chip))) { 49 if ((err = init_dsp_comm_page(chip))) {
49 DE_INIT(("init_hw - could not initialize DSP comm page\n")); 50 DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@@ -79,7 +80,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
79 return err; 80 return err;
80 81
81 err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA); 82 err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA);
82 snd_assert(err >= 0, return err); 83 if (err < 0)
84 return err;
83 err = set_professional_spdif(chip, TRUE); 85 err = set_professional_spdif(chip, TRUE);
84 86
85 DE_INIT(("init_hw done\n")); 87 DE_INIT(("init_hw done\n"));