summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_fs.c
diff options
context:
space:
mode:
authorPeter Korsgaard <peter.korsgaard@barco.com>2012-05-03 12:58:49 +0200
committerFelipe Balbi <balbi@ti.com>2012-05-04 15:53:09 +0300
commit4f06539ffa1948f1d2623f549136c87e33dc1d75 (patch)
treeac9a7e319383bbc7e3bed24f9d7b4c6b2adb86a1 /drivers/usb/gadget/f_fs.c
parentb4036ccdd2ce5ec0c4f29b91312dd3cf19fc9152 (diff)
downloadblackbird-op-linux-4f06539ffa1948f1d2623f549136c87e33dc1d75.tar.gz
blackbird-op-linux-4f06539ffa1948f1d2623f549136c87e33dc1d75.zip
f_fs: ffs_func_free: cleanup requests allocated by autoconfig
functionfs was leaking request objects created by autoconfig. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_fs.c')
-rw-r--r--drivers/usb/gadget/f_fs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index f52cb1ae45d9..1d4c535671a7 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1473,8 +1473,22 @@ static int functionfs_bind_config(struct usb_composite_dev *cdev,
static void ffs_func_free(struct ffs_function *func)
{
+ struct ffs_ep *ep = func->eps;
+ unsigned count = func->ffs->eps_count;
+ unsigned long flags;
+
ENTER();
+ /* cleanup after autoconfig */
+ spin_lock_irqsave(&func->ffs->eps_lock, flags);
+ do {
+ if (ep->ep && ep->req)
+ usb_ep_free_request(ep->ep, ep->req);
+ ep->req = NULL;
+ ++ep;
+ } while (--count);
+ spin_unlock_irqrestore(&func->ffs->eps_lock, flags);
+
ffs_data_put(func->ffs);
kfree(func->eps);
OpenPOWER on IntegriCloud