diff options
Diffstat (limited to 'sound/firewire/digi00x/digi00x-midi.c')
-rw-r--r-- | sound/firewire/digi00x/digi00x-midi.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/firewire/digi00x/digi00x-midi.c b/sound/firewire/digi00x/digi00x-midi.c index bf50a168087f..2b57ece89101 100644 --- a/sound/firewire/digi00x/digi00x-midi.c +++ b/sound/firewire/digi00x/digi00x-midi.c @@ -17,8 +17,13 @@ static int midi_open(struct snd_rawmidi_substream *substream) return err; mutex_lock(&dg00x->mutex); - dg00x->substreams_counter++; - err = snd_dg00x_stream_start_duplex(dg00x, 0); + err = snd_dg00x_stream_reserve_duplex(dg00x, 0); + if (err >= 0) { + ++dg00x->substreams_counter; + err = snd_dg00x_stream_start_duplex(dg00x); + if (err < 0) + --dg00x->substreams_counter; + } mutex_unlock(&dg00x->mutex); if (err < 0) snd_dg00x_stream_lock_release(dg00x); @@ -31,7 +36,7 @@ static int midi_close(struct snd_rawmidi_substream *substream) struct snd_dg00x *dg00x = substream->rmidi->private_data; mutex_lock(&dg00x->mutex); - dg00x->substreams_counter--; + --dg00x->substreams_counter; snd_dg00x_stream_stop_duplex(dg00x); mutex_unlock(&dg00x->mutex); |