transceiver is either NULL or a valid pointer. It is never left containing -ve error value. Simplify error checks based on this. Moreover, its OK to call phy APIs with NULL phy pointer. Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@xxxxxxxxx> --- drivers/usb/gadget/udc/pxa25x_udc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c index f6cbe66..08f39d7 100644 --- a/drivers/usb/gadget/udc/pxa25x_udc.c +++ b/drivers/usb/gadget/udc/pxa25x_udc.c @@ -991,9 +991,7 @@ static int pxa25x_udc_vbus_draw(struct usb_gadget *_gadget, unsigned mA) udc = container_of(_gadget, struct pxa25x_udc, gadget); - if (!IS_ERR_OR_NULL(udc->transceiver)) - return usb_phy_set_power(udc->transceiver, mA); - return -EOPNOTSUPP; + return usb_phy_set_power(udc->transceiver, mA); } static int pxa25x_udc_start(struct usb_gadget *g, @@ -1265,7 +1263,7 @@ static int pxa25x_udc_start(struct usb_gadget *g, * for set_configuration as well as eventual disconnect. */ /* connect to bus through transceiver */ - if (!IS_ERR_OR_NULL(dev->transceiver)) { + if (dev->transceiver) { retval = otg_set_peripheral(dev->transceiver->otg, &dev->gadget); if (retval) @@ -1341,7 +1339,7 @@ static int pxa25x_udc_stop(struct usb_gadget*g) stop_activity(dev, NULL); local_irq_enable(); - if (!IS_ERR_OR_NULL(dev->transceiver)) + if (dev->transceiver) (void) otg_set_peripheral(dev->transceiver->otg, NULL); dev->driver = NULL; @@ -2138,6 +2136,8 @@ static int pxa25x_udc_probe(struct platform_device *pdev) dev->mach = dev_get_platdata(&pdev->dev); dev->transceiver = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); + if (IS_ERR(dev->transceiver)) + dev->transceiver = NULL; if (gpio_is_valid(dev->mach->gpio_pullup)) { retval = devm_gpio_request(&pdev->dev, dev->mach->gpio_pullup, @@ -2201,8 +2201,6 @@ static int pxa25x_udc_probe(struct platform_device *pdev) remove_debug_files(dev); err: - if (!IS_ERR_OR_NULL(dev->transceiver)) - dev->transceiver = NULL; return retval; } -- 2.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html