aboutsummaryrefslogtreecommitdiffstats
path: root/sound/synth/emux/emux_synth.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/synth/emux/emux_synth.c')
-rw-r--r--sound/synth/emux/emux_synth.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c
index b343818dbb96..2cc6f6f79065 100644
--- a/sound/synth/emux/emux_synth.c
+++ b/sound/synth/emux/emux_synth.c
@@ -66,12 +66,12 @@ snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan)
66 struct snd_emux_port *port; 66 struct snd_emux_port *port;
67 67
68 port = p; 68 port = p;
69 snd_assert(port != NULL && chan != NULL, return); 69 if (snd_BUG_ON(!port || !chan))
70 return;
70 71
71 emu = port->emu; 72 emu = port->emu;
72 snd_assert(emu != NULL, return); 73 if (snd_BUG_ON(!emu || !emu->ops.get_voice || !emu->ops.trigger))
73 snd_assert(emu->ops.get_voice != NULL, return); 74 return;
74 snd_assert(emu->ops.trigger != NULL, return);
75 75
76 key = note; /* remember the original note */ 76 key = note; /* remember the original note */
77 nvoices = get_zone(emu, port, &note, vel, chan, table); 77 nvoices = get_zone(emu, port, &note, vel, chan, table);
@@ -164,11 +164,12 @@ snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan)
164 struct snd_emux_port *port; 164 struct snd_emux_port *port;
165 165
166 port = p; 166 port = p;
167 snd_assert(port != NULL && chan != NULL, return); 167 if (snd_BUG_ON(!port || !chan))
168 return;
168 169
169 emu = port->emu; 170 emu = port->emu;
170 snd_assert(emu != NULL, return); 171 if (snd_BUG_ON(!emu || !emu->ops.release))
171 snd_assert(emu->ops.release != NULL, return); 172 return;
172 173
173 spin_lock_irqsave(&emu->voice_lock, flags); 174 spin_lock_irqsave(&emu->voice_lock, flags);
174 for (ch = 0; ch < emu->max_voices; ch++) { 175 for (ch = 0; ch < emu->max_voices; ch++) {
@@ -242,11 +243,12 @@ snd_emux_key_press(void *p, int note, int vel, struct snd_midi_channel *chan)
242 struct snd_emux_port *port; 243 struct snd_emux_port *port;
243 244
244 port = p; 245 port = p;
245 snd_assert(port != NULL && chan != NULL, return); 246 if (snd_BUG_ON(!port || !chan))
247 return;
246 248
247 emu = port->emu; 249 emu = port->emu;
248 snd_assert(emu != NULL, return); 250 if (snd_BUG_ON(!emu || !emu->ops.update))
249 snd_assert(emu->ops.update != NULL, return); 251 return;
250 252
251 spin_lock_irqsave(&emu->voice_lock, flags); 253 spin_lock_irqsave(&emu->voice_lock, flags);
252 for (ch = 0; ch < emu->max_voices; ch++) { 254 for (ch = 0; ch < emu->max_voices; ch++) {
@@ -276,8 +278,8 @@ snd_emux_update_channel(struct snd_emux_port *port, struct snd_midi_channel *cha
276 return; 278 return;
277 279
278 emu = port->emu; 280 emu = port->emu;
279 snd_assert(emu != NULL, return); 281 if (snd_BUG_ON(!emu || !emu->ops.update))
280 snd_assert(emu->ops.update != NULL, return); 282 return;
281 283
282 spin_lock_irqsave(&emu->voice_lock, flags); 284 spin_lock_irqsave(&emu->voice_lock, flags);
283 for (i = 0; i < emu->max_voices; i++) { 285 for (i = 0; i < emu->max_voices; i++) {
@@ -303,8 +305,8 @@ snd_emux_update_port(struct snd_emux_port *port, int update)
303 return; 305 return;
304 306
305 emu = port->emu; 307 emu = port->emu;
306 snd_assert(emu != NULL, return); 308 if (snd_BUG_ON(!emu || !emu->ops.update))
307 snd_assert(emu->ops.update != NULL, return); 309 return;
308 310
309 spin_lock_irqsave(&emu->voice_lock, flags); 311 spin_lock_irqsave(&emu->voice_lock, flags);
310 for (i = 0; i < emu->max_voices; i++) { 312 for (i = 0; i < emu->max_voices; i++) {
@@ -326,7 +328,8 @@ snd_emux_control(void *p, int type, struct snd_midi_channel *chan)
326 struct snd_emux_port *port; 328 struct snd_emux_port *port;
327 329
328 port = p; 330 port = p;
329 snd_assert(port != NULL && chan != NULL, return); 331 if (snd_BUG_ON(!port || !chan))
332 return;
330 333
331 switch (type) { 334 switch (type) {
332 case MIDI_CTL_MSB_MAIN_VOLUME: 335 case MIDI_CTL_MSB_MAIN_VOLUME:
@@ -400,11 +403,12 @@ snd_emux_terminate_note(void *p, int note, struct snd_midi_channel *chan)
400 struct snd_emux_port *port; 403 struct snd_emux_port *port;
401 404
402 port = p; 405 port = p;
403 snd_assert(port != NULL && chan != NULL, return); 406 if (snd_BUG_ON(!port || !chan))
407 return;
404 408
405 emu = port->emu; 409 emu = port->emu;
406 snd_assert(emu != NULL, return); 410 if (snd_BUG_ON(!emu || !emu->ops.terminate))
407 snd_assert(emu->ops.terminate != NULL, return); 411 return;
408 412
409 terminate_note1(emu, note, chan, 1); 413 terminate_note1(emu, note, chan, 1);
410} 414}
@@ -451,10 +455,11 @@ snd_emux_sounds_off_all(struct snd_emux_port *port)
451 struct snd_emux_voice *vp; 455 struct snd_emux_voice *vp;
452 unsigned long flags; 456 unsigned long flags;
453 457
454 snd_assert(port != NULL, return); 458 if (snd_BUG_ON(!port))
459 return;
455 emu = port->emu; 460 emu = port->emu;
456 snd_assert(emu != NULL, return); 461 if (snd_BUG_ON(!emu || !emu->ops.terminate))
457 snd_assert(emu->ops.terminate != NULL, return); 462 return;
458 463
459 spin_lock_irqsave(&emu->voice_lock, flags); 464 spin_lock_irqsave(&emu->voice_lock, flags);
460 for (i = 0; i < emu->max_voices; i++) { 465 for (i = 0; i < emu->max_voices; i++) {