Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2246397ybb; Fri, 27 Mar 2020 01:48:18 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsCl7/5fKd1ntCU3WKsU+cVluuEHHLRnePHlAO3tKkDNMwr19BTJCuiik/yrwlFoLq2H7NA X-Received: by 2002:a4a:da1a:: with SMTP id e26mr4152197oou.19.1585298898138; Fri, 27 Mar 2020 01:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585298898; cv=none; d=google.com; s=arc-20160816; b=v9GavA4U8OFwGGMRui3opc7isIrcD8q4oIIku8tk0bjSQztUFkSjDsIAjYZ7H7P/58 Gu/GMCVqGRSff1aVB0DKOrPOPv/vPDVgphHLYQh/cRoUgYp2AEQkT60cSQiS7kKaquS+ D/ykb3iKKU2lmSuQRJYaAxp7mwDVu6MSxj7hXBRlTKou476cC1s7e0ypnCP8V047MA2F kICXoskpx/eNG+x9XQXbcKRX24Du3moAAmiGbSnL3BgkOveYs/NX2ylh+Pe0GafHAqox smmbolWPYSPWd5qBCOaCUy2wjlCDcVuiFF5J4udb1Lvwzz6YnxRo7uOJ81eCIeM53emM dS3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rL0PaJZzj/fxF3SgXjcJ8BLim2x0YtiqglVg3LVOSLc=; b=SnLrLVJcWuzF1h75u2zvwmDLG8/fZFS814Yc6hr9yhdQ1qOIbZTgtkfEu9YbwUI6w3 UY8u8qalVAJSNiTt76vcmVHyMS/IfnLpslHDw3fHbtqLTsQ0Z/Uc96Ck0tFLNIdX2xI6 noXgmmCWqg0ueN1hM01CDddAJ8ERHX26aPFuu+aiYUxKwonEN3RHhn9qV4597xL87Uf6 qR0YY1oYT/5cVnRthcruqXQyQTiNfkibFduTNRh/2JKloHg1ljt5tsBl9BgYOk89POZ/ LUjIVU48OdCPxI9FmKC0B65O5EaGbbZ74q0YcxinPQxu6Bv6OmTYzulAZ8TwPfKB+1Ah aYug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si2163043otr.13.2020.03.27.01.48.05; Fri, 27 Mar 2020 01:48:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726661AbgC0IqW (ORCPT + 99 others); Fri, 27 Mar 2020 04:46:22 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:48211 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726169AbgC0IqV (ORCPT ); Fri, 27 Mar 2020 04:46:21 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jHkd6-0001qQ-Oo; Fri, 27 Mar 2020 09:46:16 +0100 Received: from mgr by dude.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1jHkd4-0000fZ-E7; Fri, 27 Mar 2020 09:46:14 +0100 From: Michael Grzeschik To: lars@metafoo.de, alexandru.Ardelean@analog.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, balbi@kernel.org Cc: gregkh@linuxfoundation.org, bigeasy@linutronix.de, m.olbrich@pengutronix.de, kernel@pengutronix.de Subject: [PATCH] usb: dwc3: gadget: don't dequeue requests on already disabled endpoints Date: Fri, 27 Mar 2020 09:43:03 +0100 Message-Id: <20200327084302.606-1-m.grzeschik@pengutronix.de> X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mgr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dwc3_gadget_ep_disable gets called before the last request gets dequeued. In __dwc3_gadget_ep_disable all started, pending and cancelled lists for this endpoint will call dwc3_gadget_giveback in dwc3_remove_requests. After that no list containing the afterwards dequed request, therefor it is not necessary to run the dequeue routine. Signed-off-by: Michael Grzeschik --- @Lars-Peter Clausen: This patch addresses the case that not queued requests get dequeued. The only case that this happens seems on disabling the gadget. drivers/usb/dwc3/gadget.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9a6f741d1db0dc..5d4fa8d6c93e49 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1609,6 +1609,9 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, trace_dwc3_ep_dequeue(req); + if (!(dep->flags & DWC3_EP_ENABLED)) + return 0; + spin_lock_irqsave(&dwc->lock, flags); list_for_each_entry(r, &dep->pending_list, list) { -- 2.26.0.rc2