Skip to content

Commit

Permalink
usb: gadget: f_hid: use free_ep_req()
Browse files Browse the repository at this point in the history
We should always use free_ep_req() when allocating requests with
alloc_ep_req().

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  • Loading branch information
Felipe F. Tonello authored and Felipe Balbi committed Aug 25, 2016
1 parent aadbe81 commit 14794d7
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/usb/gadget/function/f_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,11 +677,8 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
usb_free_all_descriptors(f);
fail:
ERROR(f->config->cdev, "hidg_bind FAILED\n");
if (hidg->req != NULL) {
kfree(hidg->req->buf);
if (hidg->in_ep != NULL)
usb_ep_free_request(hidg->in_ep, hidg->req);
}
if (hidg->req != NULL)
free_ep_req(hidg->in_ep, hidg->req);

return status;
}
Expand Down Expand Up @@ -920,8 +917,7 @@ static void hidg_unbind(struct usb_configuration *c, struct usb_function *f)

/* disable/free request and end point */
usb_ep_disable(hidg->in_ep);
kfree(hidg->req->buf);
usb_ep_free_request(hidg->in_ep, hidg->req);
free_ep_req(hidg->in_ep, hidg->req);

usb_free_all_descriptors(f);
}
Expand Down

0 comments on commit 14794d7

Please sign in to comment.