summaryrefslogtreecommitdiff
path: root/include/linux/usb
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2019-11-14 15:08:49 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2019-11-14 15:08:46 -0800
commit01c47b8a7e64cc8c598aac10887e9ce328bbb2eb (patch)
treeeaf747311dc8ca2bac9d91520297cbf8f73a0f72 /include/linux/usb
parent39132a8d3352b23e333779ec68daec8d1ce853da (diff)
parent4547f0febbca55057d4249dd6e4e6d509dbc2e46 (diff)
Merge "Merge android-4.4-p.200 (903fbe7) into msm-4.4"
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/gadget.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index b661b6e3496b..8874ed16c836 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -361,6 +361,16 @@ static inline int usb_ep_enable(struct usb_ep *ep)
if (ep->enabled)
return 0;
+ /* UDC drivers can't handle endpoints with maxpacket size 0 */
+ if (usb_endpoint_maxp(ep->desc) == 0) {
+ /*
+ * We should log an error message here, but we can't call
+ * dev_err() because there's no way to find the gadget
+ * given only ep.
+ */
+ return -EINVAL;
+ }
+
ret = ep->ops->enable(ep, ep->desc);
if (ret)
return ret;