diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2013-06-03 12:13:39 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-06-12 16:57:11 -0400 |
commit | 594daba1bcb0510cdc9dccfbab9e6fd5d9cc94e6 (patch) | |
tree | 6af4e5e74bdc0ebe46d761ab94d6f4ea62501824 /drivers/usb/dwc3/dwc3-omap.c | |
parent | b84a8dee23fd41600a8aebcba1410b5bb5b3bdeb (diff) |
usb: dwc3: omap: improve error handling of dwc3_omap_probe
Improved the error handling of dwc3_omap_probe so that on error
conditions dwc3_omap is left in the original state.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/dwc3-omap.c')
-rw-r--r-- | drivers/usb/dwc3/dwc3-omap.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 34638b92500d..f8f76e6b7b46 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -347,7 +347,7 @@ static int dwc3_omap_probe(struct platform_device *pdev) | |||
347 | ret = pm_runtime_get_sync(dev); | 347 | ret = pm_runtime_get_sync(dev); |
348 | if (ret < 0) { | 348 | if (ret < 0) { |
349 | dev_err(dev, "get_sync failed with err %d\n", ret); | 349 | dev_err(dev, "get_sync failed with err %d\n", ret); |
350 | return ret; | 350 | goto err0; |
351 | } | 351 | } |
352 | 352 | ||
353 | reg = dwc3_omap_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS); | 353 | reg = dwc3_omap_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS); |
@@ -376,7 +376,7 @@ static int dwc3_omap_probe(struct platform_device *pdev) | |||
376 | if (ret) { | 376 | if (ret) { |
377 | dev_err(dev, "failed to request IRQ #%d --> %d\n", | 377 | dev_err(dev, "failed to request IRQ #%d --> %d\n", |
378 | omap->irq, ret); | 378 | omap->irq, ret); |
379 | return ret; | 379 | goto err1; |
380 | } | 380 | } |
381 | 381 | ||
382 | dwc3_omap_enable_irqs(omap); | 382 | dwc3_omap_enable_irqs(omap); |
@@ -384,10 +384,21 @@ static int dwc3_omap_probe(struct platform_device *pdev) | |||
384 | ret = of_platform_populate(node, NULL, NULL, dev); | 384 | ret = of_platform_populate(node, NULL, NULL, dev); |
385 | if (ret) { | 385 | if (ret) { |
386 | dev_err(&pdev->dev, "failed to create dwc3 core\n"); | 386 | dev_err(&pdev->dev, "failed to create dwc3 core\n"); |
387 | return ret; | 387 | goto err2; |
388 | } | 388 | } |
389 | 389 | ||
390 | return 0; | 390 | return 0; |
391 | |||
392 | err2: | ||
393 | dwc3_omap_disable_irqs(omap); | ||
394 | |||
395 | err1: | ||
396 | pm_runtime_put_sync(dev); | ||
397 | |||
398 | err0: | ||
399 | pm_runtime_disable(dev); | ||
400 | |||
401 | return ret; | ||
391 | } | 402 | } |
392 | 403 | ||
393 | static int dwc3_omap_remove(struct platform_device *pdev) | 404 | static int dwc3_omap_remove(struct platform_device *pdev) |