summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/function/f_midi.c
diff options
context:
space:
mode:
authorFelipe F. Tonello <eu@felipetonello.com>2015-09-18 18:36:28 +0100
committerFelipe Balbi <balbi@ti.com>2015-09-27 10:54:31 -0500
commitf35fe4beb03d4e3203a2bd734d2253060694d98f (patch)
treebf52f90d254d9113aae2bbd9f27d5697a9baf0b2 /drivers/usb/gadget/function/f_midi.c
parent2e6c72b61b9a0a7787e8cfa3fff3b34a0c2548ce (diff)
usb: gadget: f_midi: check for error on usb_ep_queue
f_midi is not checking whether there is an error on usb_ep_queue request, ignoring potential problems, such as memory leaks. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/function/f_midi.c')
-rw-r--r--drivers/usb/gadget/function/f_midi.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index a287a4829273..9fc86d90c7bd 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -547,10 +547,16 @@ static void f_midi_transmit(struct f_midi *midi, struct usb_request *req)
}
}
- if (req->length > 0)
- usb_ep_queue(ep, req, GFP_ATOMIC);
- else
+ if (req->length > 0) {
+ int err;
+
+ err = usb_ep_queue(ep, req, GFP_ATOMIC);
+ if (err < 0)
+ ERROR(midi, "%s queue req: %d\n",
+ midi->in_ep->name, err);
+ } else {
free_ep_req(ep, req);
+ }
}
static void f_midi_in_tasklet(unsigned long data)