Resolve an initizlization issue that could come up if the userspace
driver wrote invalid descriptors to a dual-speed device.

Signed-off-by: David Brownell <[EMAIL PROTECTED]>

Index: at91/drivers/usb/gadget/inode.c
===================================================================
--- at91.orig/drivers/usb/gadget/inode.c        2007-01-16 21:42:18.000000000 
-0800
+++ at91/drivers/usb/gadget/inode.c     2007-01-16 23:00:39.000000000 -0800
@@ -1392,17 +1392,17 @@ gadgetfs_setup (struct usb_gadget *gadge
        spin_lock (&dev->lock);
        dev->setup_abort = 0;
        if (dev->state == STATE_DEV_UNCONNECTED) {
-
-               dev->state = STATE_DEV_CONNECTED;
-               dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket;
-
 #ifdef CONFIG_USB_GADGET_DUALSPEED
                if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) {
+                       spin_unlock(&dev->lock);
                        ERROR (dev, "no high speed config??\n");
                        return -EINVAL;
                }
 #endif /* CONFIG_USB_GADGET_DUALSPEED */
 
+               dev->state = STATE_DEV_CONNECTED;
+               dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket;
+
                INFO (dev, "connected\n");
                event = next_event (dev, GADGETFS_CONNECT);
                event->u.speed = gadget->speed;

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to