summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Larsson <andreas@gaisler.com>2014-03-27 16:15:58 +0100
committerFelipe Balbi <balbi@ti.com>2014-04-21 14:07:27 -0500
commitb38d27e5527c33a2a1f5bb3aee39b755e57dea86 (patch)
tree0b7fed4b0390b1f576a2d14ac037f2370ec2e0d7
parent5bddbd72c6c02498aba8b48527c86d1398dba3f4 (diff)
downloadblackbird-obmc-linux-b38d27e5527c33a2a1f5bb3aee39b755e57dea86.tar.gz
blackbird-obmc-linux-b38d27e5527c33a2a1f5bb3aee39b755e57dea86.zip
usb: gadget: gr_udc: Return error code when trying to set ep.maxpacket > ep.maxpacket_limit
Make gr_ep_enable fail properly when a call requests a larger ep.maxpacket than ep.maxpacket_limit. Signed-off-by: Andreas Larsson <andreas@gaisler.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/gadget/gr_udc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c
index 253e608b57f9..72458be7763a 100644
--- a/drivers/usb/gadget/gr_udc.c
+++ b/drivers/usb/gadget/gr_udc.c
@@ -1542,6 +1542,10 @@ static int gr_ep_enable(struct usb_ep *_ep,
} else if (max == 0) {
dev_err(dev->dev, "Max payload cannot be set to 0\n");
return -EINVAL;
+ } else if (max > ep->ep.maxpacket_limit) {
+ dev_err(dev->dev, "Requested max payload %d > limit %d\n",
+ max, ep->ep.maxpacket_limit);
+ return -EINVAL;
}
spin_lock(&ep->dev->lock);
OpenPOWER on IntegriCloud