Skip to content

Commit 9063ff4

Browse files
inguingregkh
authored andcommitted
USB: gadget: dummy_hcd.c: fix nested switch statements
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 <[email protected]> Cc: David Brownell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 73d79aa commit 9063ff4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/usb/gadget/dummy_hcd.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,16 +365,14 @@ dummy_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
365365
case USB_SPEED_HIGH:
366366
if (max == 512)
367367
break;
368-
/* conserve return statements */
369-
default:
370-
switch (max) {
371-
case 8: case 16: case 32: case 64:
368+
goto done;
369+
case USB_SPEED_FULL:
370+
if (max == 8 || max == 16 || max == 32 || max == 64)
372371
/* we'll fake any legal size */
373372
break;
374-
default:
375-
case USB_SPEED_LOW:
376-
goto done;
377-
}
373+
/* save a return statement */
374+
default:
375+
goto done;
378376
}
379377
break;
380378
case USB_ENDPOINT_XFER_INT:

0 commit comments

Comments
 (0)