Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457242 > unrolled thread

[PATCH v3 8/9] usb: gadget: f_hid: use free_ep_req()

Started by"Felipe F. Tonello" <eu@felipetonello.com>
First post2016-08-05 20:40 +0200
Last post2016-08-05 20:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 8/9] usb: gadget: f_hid: use free_ep_req() "Felipe F. Tonello" <eu@felipetonello.com> - 2016-08-05 20:40 +0200

#1457242 — [PATCH v3 8/9] usb: gadget: f_hid: use free_ep_req()

From"Felipe F. Tonello" <eu@felipetonello.com>
Date2016-08-05 20:40 +0200
Subject[PATCH v3 8/9] usb: gadget: f_hid: use free_ep_req()
Message-ID<s2Sci-2Ir-19@gated-at.bofh.it>
We should always use free_ep_req() when allocating requests with
alloc_ep_req().

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
---
 drivers/usb/gadget/function/f_hid.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index e82a7468252e..a010496e4e05 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -671,11 +671,8 @@ fail_free_descs:
 	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;
 }
@@ -904,8 +901,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);
 }
-- 
2.9.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web