aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy
diff options
context:
space:
mode:
authorFabio Baltieri <fabio.baltieri@linaro.org>2013-04-03 10:02:27 -0400
committerFelipe Balbi <balbi@ti.com>2013-04-03 11:44:49 -0400
commitbb54542cfaac0e7949925b774b04b7ea069b80d1 (patch)
treed4d16a6a0d351ad53544f2039376e5485e8c7aec /drivers/usb/phy
parent9ec602ecb199653a16e1eb909551b7ba77d79922 (diff)
usb: phy: twl6030-usb: check regulator_enable return value
Since regulator_enable() is going to be marked as __must_check in the next merge window, always check regulator_enable() return value and print a warning if it fails. Cc: Hema HK <hemahk@ti.com> Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/phy-twl6030-usb.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c
index 8cd6cf49bdbd..e841474d07b8 100644
--- a/drivers/usb/phy/phy-twl6030-usb.c
+++ b/drivers/usb/phy/phy-twl6030-usb.c
@@ -211,6 +211,7 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
211 struct twl6030_usb *twl = _twl; 211 struct twl6030_usb *twl = _twl;
212 enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN; 212 enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN;
213 u8 vbus_state, hw_state; 213 u8 vbus_state, hw_state;
214 int ret;
214 215
215 hw_state = twl6030_readb(twl, TWL6030_MODULE_ID0, STS_HW_CONDITIONS); 216 hw_state = twl6030_readb(twl, TWL6030_MODULE_ID0, STS_HW_CONDITIONS);
216 217
@@ -218,7 +219,10 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
218 CONTROLLER_STAT1); 219 CONTROLLER_STAT1);
219 if (!(hw_state & STS_USB_ID)) { 220 if (!(hw_state & STS_USB_ID)) {
220 if (vbus_state & VBUS_DET) { 221 if (vbus_state & VBUS_DET) {
221 regulator_enable(twl->usb3v3); 222 ret = regulator_enable(twl->usb3v3);
223 if (ret)
224 dev_err(twl->dev, "Failed to enable usb3v3\n");
225
222 twl->asleep = 1; 226 twl->asleep = 1;
223 status = OMAP_MUSB_VBUS_VALID; 227 status = OMAP_MUSB_VBUS_VALID;
224 twl->linkstat = status; 228 twl->linkstat = status;
@@ -245,12 +249,15 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
245 struct twl6030_usb *twl = _twl; 249 struct twl6030_usb *twl = _twl;
246 enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN; 250 enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN;
247 u8 hw_state; 251 u8 hw_state;
252 int ret;
248 253
249 hw_state = twl6030_readb(twl, TWL6030_MODULE_ID0, STS_HW_CONDITIONS); 254 hw_state = twl6030_readb(twl, TWL6030_MODULE_ID0, STS_HW_CONDITIONS);
250 255
251 if (hw_state & STS_USB_ID) { 256 if (hw_state & STS_USB_ID) {
257 ret = regulator_enable(twl->usb3v3);
258 if (ret)
259 dev_err(twl->dev, "Failed to enable usb3v3\n");
252 260
253 regulator_enable(twl->usb3v3);
254 twl->asleep = 1; 261 twl->asleep = 1;
255 twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_CLR); 262 twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_CLR);
256 twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET); 263 twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET);