Skip to content

Commit

Permalink
usb: gadget: f_midi: Transmit data only when IN ep is enabled
Browse files Browse the repository at this point in the history
This makes sure f_midi doesn't try to enqueue data when the IN endpoint is
disabled, ie, USB cable is disconnected.

Reviewed-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Felipe F. Tonello authored and Felipe Balbi committed Nov 19, 2015
1 parent 8aa90cf commit e9ca7e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/gadget/function/f_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ static void f_midi_transmit(struct f_midi *midi, struct usb_request *req)
}
}

if (req->length > 0) {
if (req->length > 0 && ep->enabled) {
int err;

err = usb_ep_queue(ep, req, GFP_ATOMIC);
Expand Down

0 comments on commit e9ca7e4

Please sign in to comment.