summaryrefslogtreecommitdiff
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2012-06-26 12:10:32 (GMT)
committerFelipe Balbi <balbi@ti.com>2012-07-02 07:40:49 (GMT)
commitded017ee6c7b90f7356bd8488f8af1c10ba90490 (patch)
tree1ed1612aa13f24e1aa8480fb497d2a0311fae9cc /drivers/usb/chipidea
parentb8a3efa3a363720687d21228d6b23b988a223bbb (diff)
downloadlinux-fsl-qoriq-ded017ee6c7b90f7356bd8488f8af1c10ba90490.tar.xz
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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index a06d28b..4688ab7 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -14,6 +14,7 @@
#include <linux/device.h>
#include <linux/dmapool.h>
#include <linux/dma-mapping.h>
+#include <linux/err.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/module.h>
@@ -1712,7 +1713,7 @@ static int udc_start(struct ci13xxx *udc)
if (retval)
goto unreg_device;
- if (udc->transceiver) {
+ if (!IS_ERR_OR_NULL(udc->transceiver)) {
retval = otg_set_peripheral(udc->transceiver->otg,
&udc->gadget);
if (retval)
@@ -1729,7 +1730,7 @@ static int udc_start(struct ci13xxx *udc)
return retval;
remove_trans:
- if (udc->transceiver) {
+ if (!IS_ERR_OR_NULL(udc->transceiver)) {
otg_set_peripheral(udc->transceiver->otg, &udc->gadget);
usb_put_phy(udc->transceiver);
}
@@ -1740,7 +1741,7 @@ remove_dbg:
unreg_device:
device_unregister(&udc->gadget.dev);
put_transceiver:
- if (udc->transceiver)
+ if (!IS_ERR_OR_NULL(udc->transceiver))
usb_put_phy(udc->transceiver);
free_pools:
dma_pool_destroy(udc->td_pool);
@@ -1772,7 +1773,7 @@ static void udc_stop(struct ci13xxx *udc)
dma_pool_destroy(udc->td_pool);
dma_pool_destroy(udc->qh_pool);
- if (udc->transceiver) {
+ if (!IS_ERR_OR_NULL(udc->transceiver)) {
otg_set_peripheral(udc->transceiver->otg, NULL);
usb_put_phy(udc->transceiver);
}