diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2012-06-26 08:10:32 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-07-02 03:40:49 -0400 |
commit | ded017ee6c7b90f7356bd8488f8af1c10ba90490 (patch) | |
tree | 1ed1612aa13f24e1aa8480fb497d2a0311fae9cc /drivers/usb/host/ohci-omap.c | |
parent | b8a3efa3a363720687d21228d6b23b988a223bbb (diff) |
usb: phy: fix return value check of usb_get_phy
usb_get_phy will return -ENODEV if it's not able to find the phy. Hence
fixed all the callers of usb_get_phy to check for this error condition
instead of relying on a non-zero value as success condition.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/host/ohci-omap.c')
-rw-r--r-- | drivers/usb/host/ohci-omap.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 92a77dfd193..c7b06f504c6 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/jiffies.h> | 18 | #include <linux/jiffies.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include <linux/err.h> | ||
21 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
22 | 23 | ||
23 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
@@ -212,7 +213,7 @@ static int ohci_omap_init(struct usb_hcd *hcd) | |||
212 | #ifdef CONFIG_USB_OTG | 213 | #ifdef CONFIG_USB_OTG |
213 | if (need_transceiver) { | 214 | if (need_transceiver) { |
214 | ohci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); | 215 | ohci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); |
215 | if (ohci->transceiver) { | 216 | if (!IS_ERR_OR_NULL(ohci->transceiver)) { |
216 | int status = otg_set_host(ohci->transceiver->otg, | 217 | int status = otg_set_host(ohci->transceiver->otg, |
217 | &ohci_to_hcd(ohci)->self); | 218 | &ohci_to_hcd(ohci)->self); |
218 | dev_dbg(hcd->self.controller, "init %s transceiver, status %d\n", | 219 | dev_dbg(hcd->self.controller, "init %s transceiver, status %d\n", |
@@ -403,7 +404,7 @@ usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev) | |||
403 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 404 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
404 | 405 | ||
405 | usb_remove_hcd(hcd); | 406 | usb_remove_hcd(hcd); |
406 | if (ohci->transceiver) { | 407 | if (!IS_ERR_OR_NULL(ohci->transceiver)) { |
407 | (void) otg_set_host(ohci->transceiver->otg, 0); | 408 | (void) otg_set_host(ohci->transceiver->otg, 0); |
408 | usb_put_phy(ohci->transceiver); | 409 | usb_put_phy(ohci->transceiver); |
409 | } | 410 | } |