Skip to content

Commit

Permalink
usb: gadget: phonet: free requests in pn_bind()'s error path
Browse files Browse the repository at this point in the history
Cc: stable <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
Sebastian Andrzej Siewior authored and Felipe Balbi committed Oct 31, 2012
1 parent 7f2a926 commit d0eca71
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/usb/gadget/f_phonet.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,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;
Expand All @@ -540,14 +540,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)
Expand Down

0 comments on commit d0eca71

Please sign in to comment.