]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
usb: gadget: udc: fsl: Add missing complete function.
authorMagnus Lilja <lilja.magnus@gmail.com>
Wed, 25 Jan 2017 21:07:59 +0000 (22:07 +0100)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Thu, 6 Apr 2017 08:21:39 +0000 (09:21 +0100)
BugLink: http://bugs.launchpad.net/bugs/1673538
commit 5528954a1a0c49c6974ef1b8d6eaceff536204d5 upstream.

Commit 304f7e5e1d08 ("usb: gadget: Refactor request completion")
removed check if req->req.complete is non-NULL, resulting in a NULL
pointer derefence and a kernel panic.
This patch adds an empty complete function instead of re-introducing
the req->req.complete check.

Fixes: 304f7e5e1d08 ("usb: gadget: Refactor request completion")
Signed-off-by: Magnus Lilja <lilja.magnus@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/usb/gadget/udc/fsl_udc_core.c

index aab5221d6c2e35050edccaaa170f960f90c40887..aac0ce8aeb0bf01bbb9bfca9c1fa1dfdaab40bae 100644 (file)
@@ -1249,6 +1249,12 @@ static const struct usb_gadget_ops fsl_gadget_ops = {
        .udc_stop = fsl_udc_stop,
 };
 
+/*
+ * Empty complete function used by this driver to fill in the req->complete
+ * field when creating a request since the complete field is mandatory.
+ */
+static void fsl_noop_complete(struct usb_ep *ep, struct usb_request *req) { }
+
 /* Set protocol stall on ep0, protocol stall will automatically be cleared
    on new transaction */
 static void ep0stall(struct fsl_udc *udc)
@@ -1283,7 +1289,7 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction)
        req->req.length = 0;
        req->req.status = -EINPROGRESS;
        req->req.actual = 0;
-       req->req.complete = NULL;
+       req->req.complete = fsl_noop_complete;
        req->dtd_count = 0;
 
        ret = usb_gadget_map_request(&ep->udc->gadget, &req->req, ep_is_in(ep));
@@ -1366,7 +1372,7 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
        req->req.length = 2;
        req->req.status = -EINPROGRESS;
        req->req.actual = 0;
-       req->req.complete = NULL;
+       req->req.complete = fsl_noop_complete;
        req->dtd_count = 0;
 
        ret = usb_gadget_map_request(&ep->udc->gadget, &req->req, ep_is_in(ep));