diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-04-21 10:22:41 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-05-02 05:34:34 -0400 |
commit | d11536e4e0e99c26d33c849b44cd279cdd67b032 (patch) | |
tree | 8319291780b24636dd21c8cb06746ffc220adf84 | |
parent | cdefce169594742ace29a2016dfa381755428ab5 (diff) |
mfd: Fix usbhs_enable error handling
In the case of missing platform_data we do not hold a spin_lock,
thus we should not call spin_unlock_irqrestore in the error path.
Also simplify the error handling by separating the successful path
from error path. I think this change improves readability.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Tested-by: Steve Calfee <stevecalfee@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/mfd/omap-usb-host.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 53450f433f10..b3bb3ac5b045 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -700,8 +700,7 @@ static int usbhs_enable(struct device *dev) | |||
700 | dev_dbg(dev, "starting TI HSUSB Controller\n"); | 700 | dev_dbg(dev, "starting TI HSUSB Controller\n"); |
701 | if (!pdata) { | 701 | if (!pdata) { |
702 | dev_dbg(dev, "missing platform_data\n"); | 702 | dev_dbg(dev, "missing platform_data\n"); |
703 | ret = -ENODEV; | 703 | return -ENODEV; |
704 | goto end_enable; | ||
705 | } | 704 | } |
706 | 705 | ||
707 | spin_lock_irqsave(&omap->lock, flags); | 706 | spin_lock_irqsave(&omap->lock, flags); |
@@ -915,7 +914,8 @@ static int usbhs_enable(struct device *dev) | |||
915 | 914 | ||
916 | end_count: | 915 | end_count: |
917 | omap->count++; | 916 | omap->count++; |
918 | goto end_enable; | 917 | spin_unlock_irqrestore(&omap->lock, flags); |
918 | return 0; | ||
919 | 919 | ||
920 | err_tll: | 920 | err_tll: |
921 | if (pdata->ehci_data->phy_reset) { | 921 | if (pdata->ehci_data->phy_reset) { |
@@ -931,8 +931,6 @@ err_tll: | |||
931 | clk_disable(omap->usbhost_fs_fck); | 931 | clk_disable(omap->usbhost_fs_fck); |
932 | clk_disable(omap->usbhost_hs_fck); | 932 | clk_disable(omap->usbhost_hs_fck); |
933 | clk_disable(omap->usbhost_ick); | 933 | clk_disable(omap->usbhost_ick); |
934 | |||
935 | end_enable: | ||
936 | spin_unlock_irqrestore(&omap->lock, flags); | 934 | spin_unlock_irqrestore(&omap->lock, flags); |
937 | return ret; | 935 | return ret; |
938 | } | 936 | } |