aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-10-22 22:15:04 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-11 09:03:37 -0800
commit42fac8ebfa863c060d2e4613c0a4f8b8fdad8352 (patch)
tree82da63aee4a65820f45681d9a64a56dd5fd6105f /drivers/usb/gadget
parent1db444fb78d281a2f84f20ee38bba7711b3d31f3 (diff)
downloadkernel_samsung_espresso10-42fac8ebfa863c060d2e4613c0a4f8b8fdad8352.zip
kernel_samsung_espresso10-42fac8ebfa863c060d2e4613c0a4f8b8fdad8352.tar.gz
kernel_samsung_espresso10-42fac8ebfa863c060d2e4613c0a4f8b8fdad8352.tar.bz2
usb: gadget: phonet: free requests in pn_bind()'s error path
commit d0eca719dd11ad0619e8dd6a1f3eceb95b0216dd upstream. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/f_phonet.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
index 5e14950..459dbde 100644
--- a/drivers/usb/gadget/f_phonet.c
+++ b/drivers/usb/gadget/f_phonet.c
@@ -541,7 +541,7 @@ int pn_bind(struct usb_configuration *c, struct usb_function *f)
req = usb_ep_alloc_request(fp->out_ep, GFP_KERNEL);
if (!req)
- goto err;
+ goto err_req;
req->complete = pn_rx_complete;
fp->out_reqv[i] = req;
@@ -550,14 +550,18 @@ int pn_bind(struct usb_configuration *c, struct usb_function *f)
/* Outgoing USB requests */
fp->in_req = usb_ep_alloc_request(fp->in_ep, GFP_KERNEL);
if (!fp->in_req)
- goto err;
+ goto err_req;
INFO(cdev, "USB CDC Phonet function\n");
INFO(cdev, "using %s, OUT %s, IN %s\n", cdev->gadget->name,
fp->out_ep->name, fp->in_ep->name);
return 0;
+err_req:
+ for (i = 0; i < phonet_rxq_size && fp->out_reqv[i]; i++)
+ usb_ep_free_request(fp->out_ep, fp->out_reqv[i]);
err:
+
if (fp->out_ep)
fp->out_ep->driver_data = NULL;
if (fp->in_ep)