diff options
author | David Lopo <lopo.david@gmail.com> | 2008-04-18 21:49:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-05-02 13:25:54 -0400 |
commit | 7a6ad1dd86a45da8f235300349d4abd9ae7d1a21 (patch) | |
tree | 28f651aadce98f8037c0682d0a30cf39e0bde13a | |
parent | 7472f38b10c884f47241529d1367f77c2e1b3551 (diff) |
usb: gadget zero timer init fix
Initialize timer earlier so if an error occurs allocating USB request
or buffer request (zero_bind) Gadget Zero will not hang trying to
delete an uninitialized timer (zero_unbind).
Signed-off-by: David Lopo <lopo.david@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/gadget/zero.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 9c5057c63327..fce4924dbbe8 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -1134,6 +1134,10 @@ autoconf_fail: | |||
1134 | dev->gadget = gadget; | 1134 | dev->gadget = gadget; |
1135 | set_gadget_data(gadget, dev); | 1135 | set_gadget_data(gadget, dev); |
1136 | 1136 | ||
1137 | init_timer(&dev->resume); | ||
1138 | dev->resume.function = zero_autoresume; | ||
1139 | dev->resume.data = (unsigned long) dev; | ||
1140 | |||
1137 | /* preallocate control response and buffer */ | 1141 | /* preallocate control response and buffer */ |
1138 | dev->req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL); | 1142 | dev->req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL); |
1139 | if (!dev->req) | 1143 | if (!dev->req) |
@@ -1165,9 +1169,6 @@ autoconf_fail: | |||
1165 | 1169 | ||
1166 | usb_gadget_set_selfpowered(gadget); | 1170 | usb_gadget_set_selfpowered(gadget); |
1167 | 1171 | ||
1168 | init_timer(&dev->resume); | ||
1169 | dev->resume.function = zero_autoresume; | ||
1170 | dev->resume.data = (unsigned long) dev; | ||
1171 | if (autoresume) { | 1172 | if (autoresume) { |
1172 | source_sink_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP; | 1173 | source_sink_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP; |
1173 | loopback_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP; | 1174 | loopback_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP; |