From: David Lopo Date: Sat, 19 Apr 2008 01:49:01 +0000 (-0700) Subject: usb: gadget zero timer init fix X-Git-Tag: v2.6.26-rc1~11^2~15 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a6ad1dd86a45da8f235300349d4abd9ae7d1a21;p=linux-2.6 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 Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 9c5057c633..fce4924dbb 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c @@ -1134,6 +1134,10 @@ autoconf_fail: dev->gadget = gadget; set_gadget_data(gadget, dev); + init_timer(&dev->resume); + dev->resume.function = zero_autoresume; + dev->resume.data = (unsigned long) dev; + /* preallocate control response and buffer */ dev->req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL); if (!dev->req) @@ -1165,9 +1169,6 @@ autoconf_fail: usb_gadget_set_selfpowered(gadget); - init_timer(&dev->resume); - dev->resume.function = zero_autoresume; - dev->resume.data = (unsigned long) dev; if (autoresume) { source_sink_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP; loopback_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;