diff options
author | David Brownell <david-b@pacbell.net> | 2007-01-16 23:06:07 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-07 15:44:39 -0800 |
commit | ce46794f77f698eaf3b80922fafac5a9379085e0 (patch) | |
tree | a2adffcbc277f721d92eaa1fef3bdf6e14f66d57 /drivers/usb/gadget/inode.c | |
parent | 5b89db02a5a7c8bad3c6fb7888778082a441b385 (diff) |
USB: gadgetfs behaves better on userspace init bug
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 <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/inode.c')
-rw-r--r-- | drivers/usb/gadget/inode.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index e5ce4f0bb7c..1c5e1ee7e36 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c @@ -1392,17 +1392,17 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) 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; |