From ded017ee6c7b90f7356bd8488f8af1c10ba90490 Mon Sep 17 00:00:00 2001 From: Kishon Vijay Abraham I Date: Tue, 26 Jun 2012 17:40:32 +0530 Subject: 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 Signed-off-by: Felipe Balbi --- drivers/usb/chipidea/udc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/usb/chipidea') diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index a06d28b119f5..4688ab71bd27 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -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); } -- cgit v1.2.3-58-ga151