From: Felipe F. Tonello Date: Tue, 10 Nov 2015 17:52:03 +0000 (+0000) Subject: usb: gadget: f_midi: Transmit data only when IN ep is enabled X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=e9ca7e4bb30cbf4c8d2e2e34681a967c10b3ff54;p=deliverable%2Flinux.git usb: gadget: f_midi: Transmit data only when IN ep is enabled 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 Signed-off-by: Felipe F. Tonello Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 42acb45e1ab4..7877aa8e2aec 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c @@ -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);