]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ALSA: ump: Fix the discard error code from snd_ump_legacy_open()
authorTakashi Iwai <tiwai@suse.de>
Tue, 20 Feb 2024 15:08:43 +0000 (16:08 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 20 Feb 2024 16:06:12 +0000 (17:06 +0100)
snd_ump_legacy_open() didn't return the error code properly even if it
couldn't open.  Fix it.

Fixes: 0b5288f5fe63 ("ALSA: ump: Add legacy raw MIDI support")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240220150843.28630-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/ump.c

index 3bef1944e955ff24940c1cba0d0a82f79db33d6e..fe7911498cc4325a866a87328087c54a0a6c791a 100644 (file)
@@ -985,7 +985,7 @@ static int snd_ump_legacy_open(struct snd_rawmidi_substream *substream)
        struct snd_ump_endpoint *ump = substream->rmidi->private_data;
        int dir = substream->stream;
        int group = ump->legacy_mapping[substream->number];
-       int err;
+       int err = 0;
 
        mutex_lock(&ump->open_mutex);
        if (ump->legacy_substreams[dir][group]) {
@@ -1009,7 +1009,7 @@ static int snd_ump_legacy_open(struct snd_rawmidi_substream *substream)
        spin_unlock_irq(&ump->legacy_locks[dir]);
  unlock:
        mutex_unlock(&ump->open_mutex);
-       return 0;
+       return err;
 }
 
 static int snd_ump_legacy_close(struct snd_rawmidi_substream *substream)