]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
xilinx-usbps: Initialize ehci hcd before using it
authorLars-Peter Clausen <lars@metafoo.de>
Thu, 6 Dec 2012 11:52:14 +0000 (12:52 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 6 Dec 2012 15:12:58 +0000 (16:12 +0100)
In ehci_xusbps_setup ehci_halt is called before ehci_init. This means that the
initial ehci_halt call is working on a not completely initialized ehci hcd
struct, which might cause undefined behavior. So make sure to call ehci_init
before calling ehci_halt.

This fixes also the following lockdep warning:

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
[<c001355c>] (unwind_backtrace+0x0/0xe0) from [<c005c6c0>] (__lock_acquire+0x1ac/0x19c0)
[<c005c6c0>] (__lock_acquire+0x1ac/0x19c0) from [<c005e394>] (lock_acquire+0x60/0x74)
[<c005e394>] (lock_acquire+0x60/0x74) from [<c034843c>] (_raw_spin_lock_irq+0x50/0x60)
[<c034843c>] (_raw_spin_lock_irq+0x50/0x60) from [<c02202e8>] (ehci_halt+0x14/0xd8)
[<c02202e8>] (ehci_halt+0x14/0xd8) from [<c022532c>] (ehci_xusbps_setup+0x58/0x41c)
[<c022532c>] (ehci_xusbps_setup+0x58/0x41c) from [<c020f828>] (usb_add_hcd+0x194/0x5c0)
[<c020f828>] (usb_add_hcd+0x194/0x5c0) from [<c0223e28>] (ehci_xusbps_drv_probe+0x158/0x1e0)
[<c0223e28>] (ehci_xusbps_drv_probe+0x158/0x1e0) from [<c01c84dc>] (platform_drv_probe+0x14/0x18)
...

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
drivers/usb/host/ehci-xilinx-usbps.c

index a7edd041ee86b485e64331986d7ca938dee0facf..0b3213f7320924bd3fdeacf2f1913d55f0a5d7a7 100644 (file)
@@ -322,12 +322,12 @@ static int ehci_xusbps_setup(struct usb_hcd *hcd)
 
        hcd->has_tt = 1;
 
-       retval = ehci_halt(ehci);
+       /* data structure init */
+       retval = ehci_init(hcd);
        if (retval)
                return retval;
 
-       /* data structure init */
-       retval = ehci_init(hcd);
+       retval = ehci_halt(ehci);
        if (retval)
                return retval;