Skip to content

Commit

Permalink
usb: gadget: gr_udc: Return error code when trying to set ep.maxpacke…
Browse files Browse the repository at this point in the history
…t > 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>
  • Loading branch information
Andreas Larsson authored and Felipe Balbi committed Apr 21, 2014
1 parent 5bddbd7 commit b38d27e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/usb/gadget/gr_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b38d27e

Please sign in to comment.