summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@nvidia.com>2011-10-26 11:13:24 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:49:38 -0800
commit6bb10c63e75ee3bdbfc8c71922c2ce2f6ce70a1d (patch)
tree945ca72e2ce1c9b5a4384b4cc5ae54b4faaabd6a /drivers/usb
parente7ec505953f6f307e8ffdceeb0df8f61cfbe5414 (diff)
usb: gadget: fsl_udc_core: Fix race with vbus regulator
I observed udc_controller->vbus_regulator was set to an error value during fsl_vbus_session - it was because fsl_udc_probe was still running, and the regulator hadn't been set to NULL after printing out the error condition. Change-Id: I7f5dea54839ad1b63bc1c1854ff6f9ca0362f720 Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com> Reviewed-on: http://git-master/r/60471 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: R35a044979ffd3e053d55a5e09732beab9888be38
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 66bcef636096..59de4264c9a2 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -3033,6 +3033,18 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&udc_controller->work, fsl_udc_charger_detect_work);
INIT_WORK(&udc_controller->charger_work, fsl_udc_set_current_limit_work);
+ /* Get the regulator for drawing the vbus current in udc driver */
+ if (pdata->charge_regulator) {
+ udc_controller->vbus_regulator = regulator_get(NULL,
+ pdata->charge_regulator);
+ if (IS_ERR(udc_controller->vbus_regulator)) {
+ dev_err(&pdev->dev,
+ "can't get charge regulator,err:%ld\n",
+ PTR_ERR(udc_controller->vbus_regulator));
+ udc_controller->vbus_regulator = NULL;
+ }
+ }
+
#ifdef CONFIG_USB_OTG_UTILS
udc_controller->transceiver = otg_get_transceiver();
if (udc_controller->transceiver) {
@@ -3051,18 +3063,6 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
#endif
#endif
- /* Get the regulator for drawing the vbus current in udc driver */
- if (pdata->charge_regulator) {
- udc_controller->vbus_regulator = regulator_get(NULL,
- pdata->charge_regulator);
- if (IS_ERR(udc_controller->vbus_regulator)) {
- dev_err(&pdev->dev,
- "can't get charge regulator,err:%ld\n",
- PTR_ERR(udc_controller->vbus_regulator));
- udc_controller->vbus_regulator = NULL;
- }
- }
-
return 0;
err_del_udc: