/* Allocate a usb_request and its buffer. Returns a pointer to the usb_request or NULL if there is an error.  */
struct usb_request* gs_alloc_req(struct usb_ep *ep, unsigned len, gfp_t kmalloc_flags)
/* Allocate a usb_request and its buffer. Returns a pointer to the usb_request or NULL if there is an error.  */
struct usb_request* gs_alloc_req(struct usb_ep *ep, unsigned len, gfp_t kmalloc_flags)
{
	struct usb_request *req;
	req = usb_ep_alloc_request(ep, kmalloc_flags);
	if (req != NULL) {
		req->length = len;
		req->buf = kmalloc(len, kmalloc_flags);
		if (req->buf == NULL) {
			usb_ep_free_request(ep, req);
			return NULL;
		}
	}
	return req;
}