summaryrefslogtreecommitdiffstats
path: root/sound/usb/line6/midi.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-10-10 12:35:46 +0200
committerTakashi Iwai <tiwai@suse.de>2017-10-11 16:59:29 +0200
commit4f95646c803f6a534e58b1d33afbfdaf3e122328 (patch)
tree9d145790711b0dcdabdf2e864fea81a680bd5b4a /sound/usb/line6/midi.c
parentALSA: caiaq: Add yet more sanity checks for invalid EPs (diff)
downloadlinux-4f95646c803f6a534e58b1d33afbfdaf3e122328.tar.xz
linux-4f95646c803f6a534e58b1d33afbfdaf3e122328.zip
ALSA: line6: Add yet more sanity checks for invalid EPs
There are a few other places calling usb_submit_urb() with the URB composed from the fixed endpoint without validation. For avoiding the spurious kernel warnings, add the sanity checks to appropriate places. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/line6/midi.c')
-rw-r--r--sound/usb/line6/midi.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sound/usb/line6/midi.c b/sound/usb/line6/midi.c
index 1d3a23b02d68..6d7cde56a355 100644
--- a/sound/usb/line6/midi.c
+++ b/sound/usb/line6/midi.c
@@ -130,16 +130,21 @@ static int send_midi_async(struct usb_line6 *line6, unsigned char *data,
transfer_buffer, length, midi_sent, line6,
line6->interval);
urb->actual_length = 0;
- retval = usb_submit_urb(urb, GFP_ATOMIC);
+ retval = usb_urb_ep_type_check(urb);
+ if (retval < 0)
+ goto error;
- if (retval < 0) {
- dev_err(line6->ifcdev, "usb_submit_urb failed\n");
- usb_free_urb(urb);
- return retval;
- }
+ retval = usb_submit_urb(urb, GFP_ATOMIC);
+ if (retval < 0)
+ goto error;
++line6->line6midi->num_active_send_urbs;
return 0;
+
+ error:
+ dev_err(line6->ifcdev, "usb_submit_urb failed\n");
+ usb_free_urb(urb);
+ return retval;
}
static int line6_midi_output_open(struct snd_rawmidi_substream *substream)