@@ -125,7 +125,8 @@ static int ca_midi_input_open(struct snd_rawmidi_substream *substream)
125125 struct snd_ca_midi * midi = substream -> rmidi -> private_data ;
126126 unsigned long flags ;
127127
128- snd_assert(midi->dev_id, return -ENXIO);
128+ if (snd_BUG_ON (!midi -> dev_id ))
129+ return - ENXIO ;
129130 spin_lock_irqsave (& midi -> open_lock , flags );
130131 midi -> midi_mode |= CA_MIDI_MODE_INPUT ;
131132 midi -> substream_input = substream ;
@@ -144,7 +145,8 @@ static int ca_midi_output_open(struct snd_rawmidi_substream *substream)
144145 struct snd_ca_midi * midi = substream -> rmidi -> private_data ;
145146 unsigned long flags ;
146147
147- snd_assert(midi->dev_id, return -ENXIO);
148+ if (snd_BUG_ON (!midi -> dev_id ))
149+ return - ENXIO ;
148150 spin_lock_irqsave (& midi -> open_lock , flags );
149151 midi -> midi_mode |= CA_MIDI_MODE_OUTPUT ;
150152 midi -> substream_output = substream ;
@@ -163,7 +165,8 @@ static int ca_midi_input_close(struct snd_rawmidi_substream *substream)
163165 struct snd_ca_midi * midi = substream -> rmidi -> private_data ;
164166 unsigned long flags ;
165167
166- snd_assert(midi->dev_id, return -ENXIO);
168+ if (snd_BUG_ON (!midi -> dev_id ))
169+ return - ENXIO ;
167170 spin_lock_irqsave (& midi -> open_lock , flags );
168171 midi -> interrupt_disable (midi ,midi -> rx_enable );
169172 midi -> midi_mode &= ~CA_MIDI_MODE_INPUT ;
@@ -181,7 +184,9 @@ static int ca_midi_output_close(struct snd_rawmidi_substream *substream)
181184{
182185 struct snd_ca_midi * midi = substream -> rmidi -> private_data ;
183186 unsigned long flags ;
184- snd_assert(midi->dev_id, return -ENXIO);
187+
188+ if (snd_BUG_ON (!midi -> dev_id ))
189+ return - ENXIO ;
185190
186191 spin_lock_irqsave (& midi -> open_lock , flags );
187192
@@ -201,7 +206,9 @@ static int ca_midi_output_close(struct snd_rawmidi_substream *substream)
201206static void ca_midi_input_trigger (struct snd_rawmidi_substream * substream , int up )
202207{
203208 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 ;
205212
206213 if (up ) {
207214 midi -> interrupt_enable (midi ,midi -> rx_enable );
@@ -215,7 +222,8 @@ static void ca_midi_output_trigger(struct snd_rawmidi_substream *substream, int
215222 struct snd_ca_midi * midi = substream -> rmidi -> private_data ;
216223 unsigned long flags ;
217224
218- snd_assert(midi->dev_id, return);
225+ if (snd_BUG_ON (!midi -> dev_id ))
226+ return ;
219227
220228 if (up ) {
221229 int max = 4 ;
0 commit comments