Skip to content

Commit

Permalink
usb: dwc3: omap: improve error handling of dwc3_omap_probe
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kishon Vijay Abraham I authored and Felipe Balbi committed Jun 12, 2013
1 parent b84a8de commit 594daba
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions drivers/usb/dwc3/dwc3-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
dev_err(dev, "get_sync failed with err %d\n", ret);
return ret;
goto err0;
}

reg = dwc3_omap_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS);
Expand Down Expand Up @@ -376,18 +376,29 @@ static int dwc3_omap_probe(struct platform_device *pdev)
if (ret) {
dev_err(dev, "failed to request IRQ #%d --> %d\n",
omap->irq, ret);
return ret;
goto err1;
}

dwc3_omap_enable_irqs(omap);

ret = of_platform_populate(node, NULL, NULL, dev);
if (ret) {
dev_err(&pdev->dev, "failed to create dwc3 core\n");
return ret;
goto err2;
}

return 0;

err2:
dwc3_omap_disable_irqs(omap);

err1:
pm_runtime_put_sync(dev);

err0:
pm_runtime_disable(dev);

return ret;
}

static int dwc3_omap_remove(struct platform_device *pdev)
Expand Down

0 comments on commit 594daba

Please sign in to comment.