phy and uphy are either NULL or are valid pointers. They are never left containing -ve error values. Simplify error checks based on this. Moreover, its OK to call phy APIs with NULL phy pointer Cc: John Youn <johnyoun@xxxxxxxxxxxx> Cc: Gregory Herrero <gregory.herrero@xxxxxxxxx> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@xxxxxxxxx> --- drivers/usb/dwc2/core_intr.c | 3 +-- drivers/usb/dwc2/gadget.c | 8 +++----- drivers/usb/dwc2/hcd.c | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 927be1e..3941cbe 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -437,8 +437,7 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) udelay(100); /* Ask phy to be suspended */ - if (!IS_ERR_OR_NULL(hsotg->uphy)) - usb_phy_set_suspend(hsotg->uphy, true); + usb_phy_set_suspend(hsotg->uphy, true); skip_power_saving: /* * Change to L2 (suspend) state before releasing diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 4d47b7c..2aa7ef8 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3078,7 +3078,7 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, } s3c_hsotg_phy_enable(hsotg); - if (!IS_ERR_OR_NULL(hsotg->uphy)) + if (hsotg->uphy) otg_set_peripheral(hsotg->uphy->otg, &hsotg->gadget); spin_lock_irqsave(&hsotg->lock, flags); @@ -3133,7 +3133,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget) spin_unlock_irqrestore(&hsotg->lock, flags); - if (!IS_ERR_OR_NULL(hsotg->uphy)) + if (hsotg->uphy) otg_set_peripheral(hsotg->uphy->otg, NULL); s3c_hsotg_phy_disable(hsotg); @@ -3234,8 +3234,6 @@ static int s3c_hsotg_vbus_draw(struct usb_gadget *gadget, unsigned mA) { struct dwc2_hsotg *hsotg = to_hsotg(gadget); - if (IS_ERR_OR_NULL(hsotg->uphy)) - return -ENOTSUPP; return usb_phy_set_power(hsotg->uphy, mA); } @@ -3494,7 +3492,7 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) * If platform probe couldn't find a generic PHY or an old style * USB PHY, fall back to pdata */ - if (IS_ERR_OR_NULL(hsotg->phy) && IS_ERR_OR_NULL(hsotg->uphy)) { + if (!hsotg->phy && !hsotg->uphy) { plat = dev_get_platdata(dev); if (!plat) { dev_err(dev, diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index d9b8cc3..626d710 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -2945,7 +2945,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) /* Don't support SG list at this point */ hcd->self.sg_tablesize = 0; - if (!IS_ERR_OR_NULL(hsotg->uphy)) + if (hsotg->uphy) otg_set_host(hsotg->uphy->otg, &hcd->self); /* @@ -3000,7 +3000,7 @@ void dwc2_hcd_remove(struct dwc2_hsotg *hsotg) return; } - if (!IS_ERR_OR_NULL(hsotg->uphy)) + if (hsotg->uphy) otg_set_host(hsotg->uphy->otg, NULL); usb_remove_hcd(hcd); -- 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