Skip to content

Commit

Permalink
USB: gadget: dummy_hcd.c: fix nested switch statements
Browse files Browse the repository at this point in the history
Fix a messed up combination of two nested switch statements in
drivers/usb/gadget/dummy_hcd.c.

According to the USB spec (section 5.8.3) the maximum packet size for bulk
endpoints can be 512 for high-speed devices and 8, 16, 32 or 64 for full-speed
devices.  Low-speed devices must not have bulk endpoints.

Signed-off-by: Ingo van Lil <inguin@gmx.de>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Ingo van Lil authored and Greg Kroah-Hartman committed Apr 25, 2008
1 parent 73d79aa commit 9063ff4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions drivers/usb/gadget/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,14 @@ dummy_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
case USB_SPEED_HIGH:
if (max == 512)
break;
/* conserve return statements */
default:
switch (max) {
case 8: case 16: case 32: case 64:
goto done;
case USB_SPEED_FULL:
if (max == 8 || max == 16 || max == 32 || max == 64)
/* we'll fake any legal size */
break;
default:
case USB_SPEED_LOW:
goto done;
}
/* save a return statement */
default:
goto done;
}
break;
case USB_ENDPOINT_XFER_INT:
Expand Down

0 comments on commit 9063ff4

Please sign in to comment.