usb: gadget: f_hid: use alloc_ep_req()
authorFelipe F. Tonello <eu@felipetonello.com>
Tue, 23 Aug 2016 17:24:51 +0000 (18:24 +0100)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 25 Aug 2016 09:13:20 +0000 (12:13 +0300)
Use gadget's framework allocation function instead of directly calling
usb_ep_alloc_request().

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/f_hid.c

index aa1c19946d10130466fd43cd1bdbb57010cc27bc..e2966f87c860b49e46a7148e51e35a76ca15685c 100644 (file)
@@ -617,14 +617,10 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
 
        /* preallocate request and buffer */
        status = -ENOMEM;
-       hidg->req = usb_ep_alloc_request(hidg->in_ep, GFP_KERNEL);
+       hidg->req = alloc_ep_req(hidg->in_ep, hidg->report_length);
        if (!hidg->req)
                goto fail;
 
-       hidg->req->buf = kmalloc(hidg->report_length, GFP_KERNEL);
-       if (!hidg->req->buf)
-               goto fail;
-
        /* set descriptor dynamic values */
        hidg_interface_desc.bInterfaceSubClass = hidg->bInterfaceSubClass;
        hidg_interface_desc.bInterfaceProtocol = hidg->bInterfaceProtocol;