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/chipidea | |
| 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/chipidea')
| -rw-r--r-- | drivers/usb/chipidea/udc.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index a06d28b119f..4688ab71bd2 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/device.h> | 14 | #include <linux/device.h> |
| 15 | #include <linux/dmapool.h> | 15 | #include <linux/dmapool.h> |
| 16 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
| 17 | #include <linux/err.h> | ||
| 17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
| 18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
| 19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| @@ -1712,7 +1713,7 @@ static int udc_start(struct ci13xxx *udc) | |||
| 1712 | if (retval) | 1713 | if (retval) |
| 1713 | goto unreg_device; | 1714 | goto unreg_device; |
| 1714 | 1715 | ||
| 1715 | if (udc->transceiver) { | 1716 | if (!IS_ERR_OR_NULL(udc->transceiver)) { |
| 1716 | retval = otg_set_peripheral(udc->transceiver->otg, | 1717 | retval = otg_set_peripheral(udc->transceiver->otg, |
| 1717 | &udc->gadget); | 1718 | &udc->gadget); |
| 1718 | if (retval) | 1719 | if (retval) |
| @@ -1729,7 +1730,7 @@ static int udc_start(struct ci13xxx *udc) | |||
| 1729 | return retval; | 1730 | return retval; |
| 1730 | 1731 | ||
| 1731 | remove_trans: | 1732 | remove_trans: |
| 1732 | if (udc->transceiver) { | 1733 | if (!IS_ERR_OR_NULL(udc->transceiver)) { |
| 1733 | otg_set_peripheral(udc->transceiver->otg, &udc->gadget); | 1734 | otg_set_peripheral(udc->transceiver->otg, &udc->gadget); |
| 1734 | usb_put_phy(udc->transceiver); | 1735 | usb_put_phy(udc->transceiver); |
| 1735 | } | 1736 | } |
| @@ -1740,7 +1741,7 @@ remove_dbg: | |||
| 1740 | unreg_device: | 1741 | unreg_device: |
| 1741 | device_unregister(&udc->gadget.dev); | 1742 | device_unregister(&udc->gadget.dev); |
| 1742 | put_transceiver: | 1743 | put_transceiver: |
| 1743 | if (udc->transceiver) | 1744 | if (!IS_ERR_OR_NULL(udc->transceiver)) |
| 1744 | usb_put_phy(udc->transceiver); | 1745 | usb_put_phy(udc->transceiver); |
| 1745 | free_pools: | 1746 | free_pools: |
| 1746 | dma_pool_destroy(udc->td_pool); | 1747 | dma_pool_destroy(udc->td_pool); |
| @@ -1772,7 +1773,7 @@ static void udc_stop(struct ci13xxx *udc) | |||
| 1772 | dma_pool_destroy(udc->td_pool); | 1773 | dma_pool_destroy(udc->td_pool); |
| 1773 | dma_pool_destroy(udc->qh_pool); | 1774 | dma_pool_destroy(udc->qh_pool); |
| 1774 | 1775 | ||
| 1775 | if (udc->transceiver) { | 1776 | if (!IS_ERR_OR_NULL(udc->transceiver)) { |
| 1776 | otg_set_peripheral(udc->transceiver->otg, NULL); | 1777 | otg_set_peripheral(udc->transceiver->otg, NULL); |
| 1777 | usb_put_phy(udc->transceiver); | 1778 | usb_put_phy(udc->transceiver); |
| 1778 | } | 1779 | } |
