summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@freescale.com>2012-10-12 15:23:49 +0800
committerRobby Cai <R63905@freescale.com>2012-10-12 23:18:55 +0800
commit415a6e33057feada07d6e5f2e295ff6d0beeb6de (patch)
tree149e23752146d47070c76da726e013028867a6be
parent1a9a72b98ba330463b9e7b27edafed0ca1c64b04 (diff)
ENGR00229338: usb: fix using lock before initialization problem
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>
-rwxr-xr-xdrivers/usb/gadget/arcotg_udc.c3
-rwxr-xr-xdrivers/usb/host/ehci-arc.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/gadget/arcotg_udc.c b/drivers/usb/gadget/arcotg_udc.c
index 86518d9855ac..75fe978a8e01 100755
--- a/drivers/usb/gadget/arcotg_udc.c
+++ b/drivers/usb/gadget/arcotg_udc.c
@@ -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:
diff --git a/drivers/usb/host/ehci-arc.c b/drivers/usb/host/ehci-arc.c
index e09f4dfd05d9..35815869bb8d 100755
--- a/drivers/usb/host/ehci-arc.c
+++ b/drivers/usb/host/ehci-arc.c
@@ -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);