USB: musb: fix put_device() call sequence
authorAjay Kumar Gupta <ajay.gupta@ti.com>
Mon, 3 Aug 2009 06:13:40 +0000 (11:43 +0530)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Sep 2009 13:46:33 +0000 (06:46 -0700)
Invoke put_device(musb->xceiv->dev) before musb_platform_exit()as
xceiv is getting unregistered in musb_platform_exit().

Fixes put_device() panic when module insert/removal is performed
multiple times.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/musb/musb_core.c

index 1d26beddf2ca846f92ecfd8fa294fa8bb24ff363..3a61ddb62bd28a45947a1e4d198fe6304c2d0d5b 100644 (file)
@@ -1850,6 +1850,10 @@ static void musb_free(struct musb *musb)
                dma_controller_destroy(c);
        }
 
+#ifdef CONFIG_USB_MUSB_OTG
+       put_device(musb->xceiv->dev);
+#endif
+
        musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
        musb_platform_exit(musb);
        musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
@@ -1859,10 +1863,6 @@ static void musb_free(struct musb *musb)
                clk_put(musb->clock);
        }
 
-#ifdef CONFIG_USB_MUSB_OTG
-       put_device(musb->xceiv->dev);
-#endif
-
 #ifdef CONFIG_USB_MUSB_HDRC_HCD
        usb_put_hcd(musb_to_hcd(musb));
 #else