aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ca0106/ca_midi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ca0106/ca_midi.c')
-rw-r--r--sound/pci/ca0106/ca_midi.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sound/pci/ca0106/ca_midi.c b/sound/pci/ca0106/ca_midi.c
index 893ee4f1ea77..c7885117da33 100644
--- a/sound/pci/ca0106/ca_midi.c
+++ b/sound/pci/ca0106/ca_midi.c
@@ -125,7 +125,8 @@ static int ca_midi_input_open(struct snd_rawmidi_substream *substream)
125 struct snd_ca_midi *midi = substream->rmidi->private_data; 125 struct snd_ca_midi *midi = substream->rmidi->private_data;
126 unsigned long flags; 126 unsigned long flags;
127 127
128 snd_assert(midi->dev_id, return -ENXIO); 128 if (snd_BUG_ON(!midi->dev_id))
129 return -ENXIO;
129 spin_lock_irqsave(&midi->open_lock, flags); 130 spin_lock_irqsave(&midi->open_lock, flags);
130 midi->midi_mode |= CA_MIDI_MODE_INPUT; 131 midi->midi_mode |= CA_MIDI_MODE_INPUT;
131 midi->substream_input = substream; 132 midi->substream_input = substream;
@@ -144,7 +145,8 @@ static int ca_midi_output_open(struct snd_rawmidi_substream *substream)
144 struct snd_ca_midi *midi = substream->rmidi->private_data; 145 struct snd_ca_midi *midi = substream->rmidi->private_data;
145 unsigned long flags; 146 unsigned long flags;
146 147
147 snd_assert(midi->dev_id, return -ENXIO); 148 if (snd_BUG_ON(!midi->dev_id))
149 return -ENXIO;
148 spin_lock_irqsave(&midi->open_lock, flags); 150 spin_lock_irqsave(&midi->open_lock, flags);
149 midi->midi_mode |= CA_MIDI_MODE_OUTPUT; 151 midi->midi_mode |= CA_MIDI_MODE_OUTPUT;
150 midi->substream_output = substream; 152 midi->substream_output = substream;
@@ -163,7 +165,8 @@ static int ca_midi_input_close(struct snd_rawmidi_substream *substream)
163 struct snd_ca_midi *midi = substream->rmidi->private_data; 165 struct snd_ca_midi *midi = substream->rmidi->private_data;
164 unsigned long flags; 166 unsigned long flags;
165 167
166 snd_assert(midi->dev_id, return -ENXIO); 168 if (snd_BUG_ON(!midi->dev_id))
169 return -ENXIO;
167 spin_lock_irqsave(&midi->open_lock, flags); 170 spin_lock_irqsave(&midi->open_lock, flags);
168 midi->interrupt_disable(midi,midi->rx_enable); 171 midi->interrupt_disable(midi,midi->rx_enable);
169 midi->midi_mode &= ~CA_MIDI_MODE_INPUT; 172 midi->midi_mode &= ~CA_MIDI_MODE_INPUT;
@@ -181,7 +184,9 @@ static int ca_midi_output_close(struct snd_rawmidi_substream *substream)
181{ 184{
182 struct snd_ca_midi *midi = substream->rmidi->private_data; 185 struct snd_ca_midi *midi = substream->rmidi->private_data;
183 unsigned long flags; 186 unsigned long flags;
184 snd_assert(midi->dev_id, return -ENXIO); 187
188 if (snd_BUG_ON(!midi->dev_id))
189 return -ENXIO;
185 190
186 spin_lock_irqsave(&midi->open_lock, flags); 191 spin_lock_irqsave(&midi->open_lock, flags);
187 192
@@ -201,7 +206,9 @@ static int ca_midi_output_close(struct snd_rawmidi_substream *substream)
201static void ca_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) 206static void ca_midi_input_trigger(struct snd_rawmidi_substream *substream, int up)
202{ 207{
203 struct snd_ca_midi *midi = substream->rmidi->private_data; 208 struct snd_ca_midi *midi = substream->rmidi->private_data;
204 snd_assert(midi->dev_id, return); 209
210 if (snd_BUG_ON(!midi->dev_id))
211 return;
205 212
206 if (up) { 213 if (up) {
207 midi->interrupt_enable(midi,midi->rx_enable); 214 midi->interrupt_enable(midi,midi->rx_enable);
@@ -215,7 +222,8 @@ static void ca_midi_output_trigger(struct snd_rawmidi_substream *substream, int
215 struct snd_ca_midi *midi = substream->rmidi->private_data; 222 struct snd_ca_midi *midi = substream->rmidi->private_data;
216 unsigned long flags; 223 unsigned long flags;
217 224
218 snd_assert(midi->dev_id, return); 225 if (snd_BUG_ON(!midi->dev_id))
226 return;
219 227
220 if (up) { 228 if (up) {
221 int max = 4; 229 int max = 4;