aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/pxa25x_udc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/pxa25x_udc.c')
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index cc0b1e63dcab..fa8e93c2465f 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -21,6 +21,7 @@
21#include <linux/ioport.h> 21#include <linux/ioport.h>
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/err.h>
24#include <linux/delay.h> 25#include <linux/delay.h>
25#include <linux/slab.h> 26#include <linux/slab.h>
26#include <linux/init.h> 27#include <linux/init.h>
@@ -993,7 +994,7 @@ static int pxa25x_udc_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
993 994
994 udc = container_of(_gadget, struct pxa25x_udc, gadget); 995 udc = container_of(_gadget, struct pxa25x_udc, gadget);
995 996
996 if (udc->transceiver) 997 if (!IS_ERR_OR_NULL(udc->transceiver))
997 return usb_phy_set_power(udc->transceiver, mA); 998 return usb_phy_set_power(udc->transceiver, mA);
998 return -EOPNOTSUPP; 999 return -EOPNOTSUPP;
999} 1000}
@@ -1299,7 +1300,7 @@ fail:
1299 DMSG("registered gadget driver '%s'\n", driver->driver.name); 1300 DMSG("registered gadget driver '%s'\n", driver->driver.name);
1300 1301
1301 /* connect to bus through transceiver */ 1302 /* connect to bus through transceiver */
1302 if (dev->transceiver) { 1303 if (!IS_ERR_OR_NULL(dev->transceiver)) {
1303 retval = otg_set_peripheral(dev->transceiver->otg, 1304 retval = otg_set_peripheral(dev->transceiver->otg,
1304 &dev->gadget); 1305 &dev->gadget);
1305 if (retval) { 1306 if (retval) {
@@ -1359,7 +1360,7 @@ static int pxa25x_stop(struct usb_gadget_driver *driver)
1359 stop_activity(dev, driver); 1360 stop_activity(dev, driver);
1360 local_irq_enable(); 1361 local_irq_enable();
1361 1362
1362 if (dev->transceiver) 1363 if (!IS_ERR_OR_NULL(dev->transceiver))
1363 (void) otg_set_peripheral(dev->transceiver->otg, NULL); 1364 (void) otg_set_peripheral(dev->transceiver->otg, NULL);
1364 1365
1365 driver->unbind(&dev->gadget); 1366 driver->unbind(&dev->gadget);
@@ -2237,7 +2238,7 @@ lubbock_fail0:
2237 if (gpio_is_valid(dev->mach->gpio_pullup)) 2238 if (gpio_is_valid(dev->mach->gpio_pullup))
2238 gpio_free(dev->mach->gpio_pullup); 2239 gpio_free(dev->mach->gpio_pullup);
2239 err_gpio_pullup: 2240 err_gpio_pullup:
2240 if (dev->transceiver) { 2241 if (!IS_ERR_OR_NULL(dev->transceiver)) {
2241 usb_put_phy(dev->transceiver); 2242 usb_put_phy(dev->transceiver);
2242 dev->transceiver = NULL; 2243 dev->transceiver = NULL;
2243 } 2244 }
@@ -2279,7 +2280,7 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev)
2279 2280
2280 clk_put(dev->clk); 2281 clk_put(dev->clk);
2281 2282
2282 if (dev->transceiver) { 2283 if (!IS_ERR_OR_NULL(dev->transceiver)) {
2283 usb_put_phy(dev->transceiver); 2284 usb_put_phy(dev->transceiver);
2284 dev->transceiver = NULL; 2285 dev->transceiver = NULL;
2285 } 2286 }