aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/core/rawmidi.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 4e26563431c..818b1299ed9 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -242,8 +242,6 @@ static int assign_substream(struct snd_rawmidi *rmidi, int subdevice,
242 return -ENXIO; 242 return -ENXIO;
243 if (subdevice >= 0 && subdevice >= s->substream_count) 243 if (subdevice >= 0 && subdevice >= s->substream_count)
244 return -ENODEV; 244 return -ENODEV;
245 if (s->substream_opened >= s->substream_count)
246 return -EAGAIN;
247 245
248 list_for_each_entry(substream, &s->substreams, list) { 246 list_for_each_entry(substream, &s->substreams, list) {
249 if (substream->opened) { 247 if (substream->opened) {
@@ -280,9 +278,9 @@ static int open_substream(struct snd_rawmidi *rmidi,
280 substream->active_sensing = 0; 278 substream->active_sensing = 0;
281 if (mode & SNDRV_RAWMIDI_LFLG_APPEND) 279 if (mode & SNDRV_RAWMIDI_LFLG_APPEND)
282 substream->append = 1; 280 substream->append = 1;
281 rmidi->streams[substream->stream].substream_opened++;
283 } 282 }
284 substream->use_count++; 283 substream->use_count++;
285 rmidi->streams[substream->stream].substream_opened++;
286 return 0; 284 return 0;
287} 285}
288 286
@@ -466,7 +464,6 @@ static void close_substream(struct snd_rawmidi *rmidi,
466 struct snd_rawmidi_substream *substream, 464 struct snd_rawmidi_substream *substream,
467 int cleanup) 465 int cleanup)
468{ 466{
469 rmidi->streams[substream->stream].substream_opened--;
470 if (--substream->use_count) 467 if (--substream->use_count)
471 return; 468 return;
472 469
@@ -491,6 +488,7 @@ static void close_substream(struct snd_rawmidi *rmidi,
491 snd_rawmidi_runtime_free(substream); 488 snd_rawmidi_runtime_free(substream);
492 substream->opened = 0; 489 substream->opened = 0;
493 substream->append = 0; 490 substream->append = 0;
491 rmidi->streams[substream->stream].substream_opened--;
494} 492}
495 493
496static void rawmidi_release_priv(struct snd_rawmidi_file *rfile) 494static void rawmidi_release_priv(struct snd_rawmidi_file *rfile)