Skip to content

Commit

Permalink
usb: gadget: gr_udc: Fix check for invalid number of microframes
Browse files Browse the repository at this point in the history
The value 0x3 (not 0x11) in the field for additional transaction/microframe
is reserved and should not be let through. Be clear in the error message about
what value caused the error return.

Reported-by: David Binderman <dcb314@hotmail.com>
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 Jun 27, 2014
1 parent 7adb5c8 commit 6ee96cc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/usb/gadget/gr_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1532,8 +1532,9 @@ static int gr_ep_enable(struct usb_ep *_ep,
"%s mode: multiple trans./microframe not valid\n",
(mode == 2 ? "Bulk" : "Control"));
return -EINVAL;
} else if (nt == 0x11) {
dev_err(dev->dev, "Invalid value for trans./microframe\n");
} else if (nt == 0x3) {
dev_err(dev->dev,
"Invalid value 0x3 for additional trans./microframe\n");
return -EINVAL;
} else if ((nt + 1) * max > buffer_size) {
dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n",
Expand Down

0 comments on commit 6ee96cc

Please sign in to comment.