Skip to content

Commit

Permalink
fotg210-udc: Add missing completion handler
Browse files Browse the repository at this point in the history
[ Upstream commit e55f673 ]

This is used when responding to GET_STATUS requests. Without this, it
crashes on completion.

Fixes: b84a8de ("usb: gadget: add Faraday fotg210_udc driver")
Signed-off-by: Fabian Vogt <fabian@ritter-vogt.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230123073508.2350402-2-linus.walleij@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Vogtinator authored and gregkh committed Mar 10, 2023
1 parent e851996 commit bdefbe1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/usb/gadget/udc/fotg210-udc.c
Expand Up @@ -706,6 +706,20 @@ static int fotg210_is_epnstall(struct fotg210_ep *ep)
return value & INOUTEPMPSR_STL_EP ? 1 : 0;
}

/* For EP0 requests triggered by this driver (currently GET_STATUS response) */
static void fotg210_ep0_complete(struct usb_ep *_ep, struct usb_request *req)
{
struct fotg210_ep *ep;
struct fotg210_udc *fotg210;

ep = container_of(_ep, struct fotg210_ep, ep);
fotg210 = ep->fotg210;

if (req->status || req->actual != req->length) {
dev_warn(&fotg210->gadget.dev, "EP0 request failed: %d\n", req->status);
}
}

static void fotg210_get_status(struct fotg210_udc *fotg210,
struct usb_ctrlrequest *ctrl)
{
Expand Down Expand Up @@ -1171,6 +1185,8 @@ static int fotg210_udc_probe(struct platform_device *pdev)
if (fotg210->ep0_req == NULL)
goto err_map;

fotg210->ep0_req->complete = fotg210_ep0_complete;

fotg210_init(fotg210);

fotg210_disable_unplug(fotg210);
Expand Down

0 comments on commit bdefbe1

Please sign in to comment.