usb: gadget zero timer init fix

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, May 2, 2008 - 11:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7a6ad1...
Commit:     7a6ad1dd86a45da8f235300349d4abd9ae7d1a21
Parent:     7472f38b10c884f47241529d1367f77c2e1b3551
Author:     David Lopo <lopo.david@gmail.com>
AuthorDate: Fri Apr 18 18:49:01 2008 -0700
Committer:  Greg Kroah-Hartman <gregkh@suse.de>
CommitDate: Fri May 2 10:25:54 2008 -0700

    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>
---
 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 9c5057c..fce4924 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;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
usb: gadget zero timer init fix, Linux Kernel Mailing ..., (Fri May 2, 11:59 am)