Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 168534
b: refs/heads/master
c: b7fe750
h: refs/heads/master
v: v3
  • Loading branch information
Clemens Ladisch authored and Takashi Iwai committed Nov 10, 2009
1 parent e028969 commit a351720
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 16fb109644b5644e42ececeff644514de6f4bd03
refs/heads/master: b7fe750fcceda4fa6bef399b0e2812562728ea82
19 changes: 7 additions & 12 deletions trunk/sound/core/rawmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,10 @@ static int open_substream(struct snd_rawmidi *rmidi,
if (err < 0)
return err;
err = substream->ops->open(substream);
if (err < 0)
if (err < 0) {
snd_rawmidi_runtime_free(substream);
return err;
}
substream->opened = 1;
substream->active_sensing = 0;
if (mode & SNDRV_RAWMIDI_LFLG_APPEND)
Expand All @@ -300,41 +302,34 @@ static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode,
SNDRV_RAWMIDI_STREAM_INPUT,
mode, &sinput);
if (err < 0)
goto __error;
return err;
}
if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) {
err = assign_substream(rmidi, subdevice,
SNDRV_RAWMIDI_STREAM_OUTPUT,
mode, &soutput);
if (err < 0)
goto __error;
return err;
}

if (sinput) {
err = open_substream(rmidi, sinput, mode);
if (err < 0)
goto __error;
return err;
}
if (soutput) {
err = open_substream(rmidi, soutput, mode);
if (err < 0) {
if (sinput)
close_substream(rmidi, sinput, 0);
goto __error;
return err;
}
}

rfile->rmidi = rmidi;
rfile->input = sinput;
rfile->output = soutput;
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 */
Expand Down

0 comments on commit a351720

Please sign in to comment.