|
@@ -272,8 +272,10 @@ static int open_substream(struct snd_rawmidi *rmidi,
|
|
if (err < 0)
|
|
if (err < 0)
|
|
return err;
|
|
return err;
|
|
err = substream->ops->open(substream);
|
|
err = substream->ops->open(substream);
|
|
- if (err < 0)
|
|
|
|
|
|
+ if (err < 0) {
|
|
|
|
+ snd_rawmidi_runtime_free(substream);
|
|
return err;
|
|
return err;
|
|
|
|
+ }
|
|
substream->opened = 1;
|
|
substream->opened = 1;
|
|
substream->active_sensing = 0;
|
|
substream->active_sensing = 0;
|
|
if (mode & SNDRV_RAWMIDI_LFLG_APPEND)
|
|
if (mode & SNDRV_RAWMIDI_LFLG_APPEND)
|
|
@@ -300,27 +302,27 @@ static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode,
|
|
SNDRV_RAWMIDI_STREAM_INPUT,
|
|
SNDRV_RAWMIDI_STREAM_INPUT,
|
|
mode, &sinput);
|
|
mode, &sinput);
|
|
if (err < 0)
|
|
if (err < 0)
|
|
- goto __error;
|
|
|
|
|
|
+ return err;
|
|
}
|
|
}
|
|
if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) {
|
|
if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) {
|
|
err = assign_substream(rmidi, subdevice,
|
|
err = assign_substream(rmidi, subdevice,
|
|
SNDRV_RAWMIDI_STREAM_OUTPUT,
|
|
SNDRV_RAWMIDI_STREAM_OUTPUT,
|
|
mode, &soutput);
|
|
mode, &soutput);
|
|
if (err < 0)
|
|
if (err < 0)
|
|
- goto __error;
|
|
|
|
|
|
+ return err;
|
|
}
|
|
}
|
|
|
|
|
|
if (sinput) {
|
|
if (sinput) {
|
|
err = open_substream(rmidi, sinput, mode);
|
|
err = open_substream(rmidi, sinput, mode);
|
|
if (err < 0)
|
|
if (err < 0)
|
|
- goto __error;
|
|
|
|
|
|
+ return err;
|
|
}
|
|
}
|
|
if (soutput) {
|
|
if (soutput) {
|
|
err = open_substream(rmidi, soutput, mode);
|
|
err = open_substream(rmidi, soutput, mode);
|
|
if (err < 0) {
|
|
if (err < 0) {
|
|
if (sinput)
|
|
if (sinput)
|
|
close_substream(rmidi, sinput, 0);
|
|
close_substream(rmidi, sinput, 0);
|
|
- goto __error;
|
|
|
|
|
|
+ return err;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -328,13 +330,6 @@ static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode,
|
|
rfile->input = sinput;
|
|
rfile->input = sinput;
|
|
rfile->output = soutput;
|
|
rfile->output = soutput;
|
|
return 0;
|
|
return 0;
|
|
-
|
|
|
|
- __error:
|
|
|
|
- if (sinput && sinput->runtime)
|
|
|
|
- snd_rawmidi_runtime_free(sinput);
|
|
|
|
- if (soutput && soutput->runtime)
|
|
|
|
- snd_rawmidi_runtime_free(soutput);
|
|
|
|
- return err;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/* called from sound/core/seq/seq_midi.c */
|
|
/* called from sound/core/seq/seq_midi.c */
|