From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3ACC6BA49 for ; Tue, 7 Mar 2023 18:59:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92E1EC4339B; Tue, 7 Mar 2023 18:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678215595; bh=r7HxLKp8gB57cfM23srg7AcsEKM0tGfwTnQxZwk08FE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qdM5FDeCBVYExTYEOzw1iIOk7r80ZiPNh6bc49/wfjAqNH4KyUYNAmIvraIvhhhD9 kqHVp5DpFgCeq+9KrbEH9oZ9FogBXC38KAMgMSPhySuoAur+ENssZMChwlDh7Wt7/O dHkLo/yV9+n4tdiVyXDG+AGiUD2cDngGWA6MjZCI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Fabian Vogt , Linus Walleij , Sasha Levin Subject: [PATCH 5.15 312/567] fotg210-udc: Add missing completion handler Date: Tue, 7 Mar 2023 18:00:48 +0100 Message-Id: <20230307165919.382683200@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307165905.838066027@linuxfoundation.org> References: <20230307165905.838066027@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Fabian Vogt [ Upstream commit e55f67391fa986f7357edba0ca59e668d99c3a5f ] This is used when responding to GET_STATUS requests. Without this, it crashes on completion. Fixes: b84a8dee23fd ("usb: gadget: add Faraday fotg210_udc driver") Signed-off-by: Fabian Vogt Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20230123073508.2350402-2-linus.walleij@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/udc/fotg210-udc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c index d0e051beb3af9..6f7ade156437a 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c @@ -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) { @@ -1172,6 +1186,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); -- 2.39.2