diff options
author | Magnus Lilja <lilja.magnus@gmail.com> | 2017-01-25 16:07:59 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-12 00:41:49 -0500 |
commit | 92ee9483bc5fe7d4c2e6730515849467d818f8f7 (patch) | |
tree | e7e03ed7823232f0f97ee3906fb3819a9665f550 | |
parent | 881b5225558e2bad2f02aca4058b269dce0a834d (diff) |
usb: gadget: udc: fsl: Add missing complete function.
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>
-rw-r--r-- | drivers/usb/gadget/udc/fsl_udc_core.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c index aab5221d6c2e..aac0ce8aeb0b 100644 --- a/drivers/usb/gadget/udc/fsl_udc_core.c +++ b/drivers/usb/gadget/udc/fsl_udc_core.c | |||
@@ -1249,6 +1249,12 @@ static const struct usb_gadget_ops fsl_gadget_ops = { | |||
1249 | .udc_stop = fsl_udc_stop, | 1249 | .udc_stop = fsl_udc_stop, |
1250 | }; | 1250 | }; |
1251 | 1251 | ||
1252 | /* | ||
1253 | * Empty complete function used by this driver to fill in the req->complete | ||
1254 | * field when creating a request since the complete field is mandatory. | ||
1255 | */ | ||
1256 | static void fsl_noop_complete(struct usb_ep *ep, struct usb_request *req) { } | ||
1257 | |||
1252 | /* Set protocol stall on ep0, protocol stall will automatically be cleared | 1258 | /* Set protocol stall on ep0, protocol stall will automatically be cleared |
1253 | on new transaction */ | 1259 | on new transaction */ |
1254 | static void ep0stall(struct fsl_udc *udc) | 1260 | static void ep0stall(struct fsl_udc *udc) |
@@ -1283,7 +1289,7 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction) | |||
1283 | req->req.length = 0; | 1289 | req->req.length = 0; |
1284 | req->req.status = -EINPROGRESS; | 1290 | req->req.status = -EINPROGRESS; |
1285 | req->req.actual = 0; | 1291 | req->req.actual = 0; |
1286 | req->req.complete = NULL; | 1292 | req->req.complete = fsl_noop_complete; |
1287 | req->dtd_count = 0; | 1293 | req->dtd_count = 0; |
1288 | 1294 | ||
1289 | ret = usb_gadget_map_request(&ep->udc->gadget, &req->req, ep_is_in(ep)); | 1295 | 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, | |||
1366 | req->req.length = 2; | 1372 | req->req.length = 2; |
1367 | req->req.status = -EINPROGRESS; | 1373 | req->req.status = -EINPROGRESS; |
1368 | req->req.actual = 0; | 1374 | req->req.actual = 0; |
1369 | req->req.complete = NULL; | 1375 | req->req.complete = fsl_noop_complete; |
1370 | req->dtd_count = 0; | 1376 | req->dtd_count = 0; |
1371 | 1377 | ||
1372 | ret = usb_gadget_map_request(&ep->udc->gadget, &req->req, ep_is_in(ep)); | 1378 | ret = usb_gadget_map_request(&ep->udc->gadget, &req->req, ep_is_in(ep)); |