]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00229338: usb: fix using lock before initialization problem
authorPeter Chen <peter.chen@freescale.com>
Fri, 12 Oct 2012 07:23:49 +0000 (15:23 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:35:32 +0000 (08:35 +0200)
It will cause below problem if spin_lock debug is on:

BUG: spinlock lockup on CPU#0, swapper/1, 9a0292a0

The reason is the lock is used before initialization.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
drivers/usb/gadget/arcotg_udc.c
drivers/usb/host/ehci-arc.c

index 86518d9855ac944bab27f59d89523b6a8740d4f8..75fe978a8e01be8ae63e6b874559e607c9e589f4 100755 (executable)
@@ -3065,6 +3065,8 @@ static int __devinit fsl_udc_probe(struct platform_device *pdev)
                goto err2a;
        }
 
+       spin_lock_init(&pdata->lock);
+
        /* Due to mx35/mx25's phy's bug */
        reset_phy();
 
@@ -3210,7 +3212,6 @@ static int __devinit fsl_udc_probe(struct platform_device *pdev)
        udc_controller->charger.enable = false;
 #endif
 
-       spin_lock_init(&pdata->lock);
        return 0;
 
 err4:
index e09f4dfd05d91916d02d2c1814372efd4d06aa95..35815869bb8df9943c62f9994fbb8cd0cdb34cbc 100755 (executable)
@@ -260,6 +260,8 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver,
                goto err4;
        }
 
+       spin_lock_init(&pdata->lock);
+
        fsl_platform_set_host_mode(hcd);
        hcd->power_budget = pdata->power_budget;
        ehci = hcd_to_ehci(hcd);
@@ -308,7 +310,6 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver,
 
        ehci = hcd_to_ehci(hcd);
        pdata->pm_command = ehci->command;
-       spin_lock_init(&pdata->lock);
        return retval;
 err6:
        free_irq(irq, (void *)pdev);