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/ehci-tegra.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/ehci-tegra.c')
-rw-r--r-- | drivers/usb/host/ehci-tegra.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 14df2f5cf6ae..477ecfa05154 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/err.h> | ||
20 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
21 | #include <linux/platform_data/tegra_usb.h> | 22 | #include <linux/platform_data/tegra_usb.h> |
22 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
@@ -750,7 +751,7 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
750 | #ifdef CONFIG_USB_OTG_UTILS | 751 | #ifdef CONFIG_USB_OTG_UTILS |
751 | if (pdata->operating_mode == TEGRA_USB_OTG) { | 752 | if (pdata->operating_mode == TEGRA_USB_OTG) { |
752 | tegra->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); | 753 | tegra->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); |
753 | if (tegra->transceiver) | 754 | if (!IS_ERR_OR_NULL(tegra->transceiver)) |
754 | otg_set_host(tegra->transceiver->otg, &hcd->self); | 755 | otg_set_host(tegra->transceiver->otg, &hcd->self); |
755 | } | 756 | } |
756 | #endif | 757 | #endif |
@@ -773,7 +774,7 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
773 | 774 | ||
774 | fail: | 775 | fail: |
775 | #ifdef CONFIG_USB_OTG_UTILS | 776 | #ifdef CONFIG_USB_OTG_UTILS |
776 | if (tegra->transceiver) { | 777 | if (!IS_ERR_OR_NULL(tegra->transceiver)) { |
777 | otg_set_host(tegra->transceiver->otg, NULL); | 778 | otg_set_host(tegra->transceiver->otg, NULL); |
778 | usb_put_phy(tegra->transceiver); | 779 | usb_put_phy(tegra->transceiver); |
779 | } | 780 | } |
@@ -808,7 +809,7 @@ static int tegra_ehci_remove(struct platform_device *pdev) | |||
808 | pm_runtime_put_noidle(&pdev->dev); | 809 | pm_runtime_put_noidle(&pdev->dev); |
809 | 810 | ||
810 | #ifdef CONFIG_USB_OTG_UTILS | 811 | #ifdef CONFIG_USB_OTG_UTILS |
811 | if (tegra->transceiver) { | 812 | if (!IS_ERR_OR_NULL(tegra->transceiver)) { |
812 | otg_set_host(tegra->transceiver->otg, NULL); | 813 | otg_set_host(tegra->transceiver->otg, NULL); |
813 | usb_put_phy(tegra->transceiver); | 814 | usb_put_phy(tegra->transceiver); |
814 | } | 815 | } |