summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/s3c-hsudc.c
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2012-06-26 17:40:32 +0530
committerFelipe Balbi <balbi@ti.com>2012-07-02 10:40:49 +0300
commitded017ee6c7b90f7356bd8488f8af1c10ba90490 (patch)
tree1ed1612aa13f24e1aa8480fb497d2a0311fae9cc /drivers/usb/gadget/s3c-hsudc.c
parentb8a3efa3a363720687d21228d6b23b988a223bbb (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/gadget/s3c-hsudc.c')
-rw-r--r--drivers/usb/gadget/s3c-hsudc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c
index 22326f274466..7c915625f240 100644
--- a/drivers/usb/gadget/s3c-hsudc.c
+++ b/drivers/usb/gadget/s3c-hsudc.c
@@ -24,6 +24,7 @@
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/clk.h>
+#include <linux/err.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/usb/otg.h>
@@ -1165,7 +1166,7 @@ static int s3c_hsudc_start(struct usb_gadget *gadget,
}
/* connect to bus through transceiver */
- if (hsudc->transceiver) {
+ if (!IS_ERR_OR_NULL(hsudc->transceiver)) {
ret = otg_set_peripheral(hsudc->transceiver->otg,
&hsudc->gadget);
if (ret) {
@@ -1220,7 +1221,7 @@ static int s3c_hsudc_stop(struct usb_gadget *gadget,
s3c_hsudc_stop_activity(hsudc);
spin_unlock_irqrestore(&hsudc->lock, flags);
- if (hsudc->transceiver)
+ if (!IS_ERR_OR_NULL(hsudc->transceiver))
(void) otg_set_peripheral(hsudc->transceiver->otg, NULL);
disable_irq(hsudc->irq);
@@ -1249,7 +1250,7 @@ static int s3c_hsudc_vbus_draw(struct usb_gadget *gadget, unsigned mA)
if (!hsudc)
return -ENODEV;
- if (hsudc->transceiver)
+ if (!IS_ERR_OR_NULL(hsudc->transceiver))
return usb_phy_set_power(hsudc->transceiver, mA);
return -EOPNOTSUPP;
@@ -1385,7 +1386,7 @@ err_irq:
err_remap:
release_mem_region(res->start, resource_size(res));
err_res:
- if (hsudc->transceiver)
+ if (!IS_ERR_OR_NULL(hsudc->transceiver))
usb_put_phy(hsudc->transceiver);
regulator_bulk_free(ARRAY_SIZE(hsudc->supplies), hsudc->supplies);