Commit d11536e4 authored by Axel Lin's avatar Axel Lin Committed by Felipe Balbi

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: default avatarAxel Lin <axel.lin@gmail.com>
Tested-by: default avatarSteve Calfee <stevecalfee@gmail.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent cdefce16
...@@ -700,8 +700,7 @@ static int usbhs_enable(struct device *dev) ...@@ -700,8 +700,7 @@ static int usbhs_enable(struct device *dev)
dev_dbg(dev, "starting TI HSUSB Controller\n"); dev_dbg(dev, "starting TI HSUSB Controller\n");
if (!pdata) { if (!pdata) {
dev_dbg(dev, "missing platform_data\n"); dev_dbg(dev, "missing platform_data\n");
ret = -ENODEV; return -ENODEV;
goto end_enable;
} }
spin_lock_irqsave(&omap->lock, flags); spin_lock_irqsave(&omap->lock, flags);
...@@ -915,7 +914,8 @@ static int usbhs_enable(struct device *dev) ...@@ -915,7 +914,8 @@ static int usbhs_enable(struct device *dev)
end_count: end_count:
omap->count++; omap->count++;
goto end_enable; spin_unlock_irqrestore(&omap->lock, flags);
return 0;
err_tll: err_tll:
if (pdata->ehci_data->phy_reset) { if (pdata->ehci_data->phy_reset) {
...@@ -931,8 +931,6 @@ static int usbhs_enable(struct device *dev) ...@@ -931,8 +931,6 @@ static int usbhs_enable(struct device *dev)
clk_disable(omap->usbhost_fs_fck); clk_disable(omap->usbhost_fs_fck);
clk_disable(omap->usbhost_hs_fck); clk_disable(omap->usbhost_hs_fck);
clk_disable(omap->usbhost_ick); clk_disable(omap->usbhost_ick);
end_enable:
spin_unlock_irqrestore(&omap->lock, flags); spin_unlock_irqrestore(&omap->lock, flags);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment