All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo van Lil <inguin@gmx.de>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Fix nested switch statements in dummy_hcd.c
Date: Thu, 13 Mar 2008 15:58:49 +0100	[thread overview]
Message-ID: <47D94129.5030601@gmx.de> (raw)

Hello everybody,

this patch fixes 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.

Cheers,
Ingo


Signed-off-by: Ingo van Lil <inguin@gmx.de>
---

--- linux-2.6.23.1/drivers/usb/gadget/dummy_hcd.c.orig	2008-03-13 15:45:35.000000000 +0100
+++ linux-2.6.23.1/drivers/usb/gadget/dummy_hcd.c	2008-03-13 15:45:39.000000000 +0100
@@ -363,16 +363,14 @@
  		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:

                 reply	other threads:[~2008-03-13 15:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47D94129.5030601@gmx.de \
    --to=inguin@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.