From: EJ Hsu <ejh@nvidia.com>
To: <linux-usb@vger.kernel.org>
Cc: EJ Hsu <ejh@nvidia.com>
Subject: [PATCH] usb: gadget: fix wrong endpoint desc
Date: Tue, 3 Dec 2019 02:46:48 -0800 [thread overview]
Message-ID: <20191203104648.29291-1-ejh@nvidia.com> (raw)
Gadget driver should always use config_ep_by_speed() to initialize
usb_ep struct according to usb device's operating speed. Otherwise,
usb_ep struct may be wrong if usb devcie's operating speed is changed.
Signed-off-by: EJ Hsu <ejh@nvidia.com>
---
drivers/usb/gadget/function/f_ecm.c | 4 ++++
drivers/usb/gadget/function/f_rndis.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c
index 6ce044008cf6..494fe4e38a65 100644
--- a/drivers/usb/gadget/function/f_ecm.c
+++ b/drivers/usb/gadget/function/f_ecm.c
@@ -623,6 +623,10 @@ static void ecm_disable(struct usb_function *f)
if (ecm->port.in_ep->enabled)
gether_disconnect(&ecm->port);
+ else {
+ ecm->port.in_ep->desc = NULL;
+ ecm->port.out_ep->desc = NULL;
+ }
usb_ep_disable(ecm->notify);
ecm->notify->desc = NULL;
diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
index d48df36622b7..0d8e4a364ca6 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -618,6 +618,7 @@ static void rndis_disable(struct usb_function *f)
gether_disconnect(&rndis->port);
usb_ep_disable(rndis->notify);
+ rndis->notify->desc = NULL;
}
/*-------------------------------------------------------------------------*/
--
2.17.1
next reply other threads:[~2019-12-03 10:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-03 10:46 EJ Hsu [this message]
2019-12-03 12:31 ` [PATCH] usb: gadget: fix wrong endpoint desc Felipe Balbi
2019-12-04 2:58 ` EJ Hsu
2019-12-04 12:15 ` Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191203104648.29291-1-ejh@nvidia.com \
--to=ejh@nvidia.com \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).