From: Felipe Balbi Date: Thu, 10 Dec 2015 19:08:20 +0000 (-0600) Subject: UPSTREAM: usb: dwc3: gadget: pass a condition to dev_WARN_ONCE() X-Git-Tag: firefly_0821_release~3272 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a1c3fa1060ca430f1033c5f9df75ea487705114c;p=firefly-linux-kernel-4.4.55.git UPSTREAM: usb: dwc3: gadget: pass a condition to dev_WARN_ONCE() instead of using: if (condition) { dev_WARN_ONCE(dev, true, "foo"); return -EINVAL; } let's use: if (dev_WARN_ONCE(dev, condition, "foo")) return -EINVAL; Signed-off-by: Felipe Balbi (cherry picked from commit 95ca961c758cd9ce789247098b09c39017637e58) Change-Id: I8a7ee1e00ddf619d23ab974663c11fe795e9a478 Signed-off-by: Wu Liang feng --- diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 975801839355..64b2a8303d33 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -661,11 +661,10 @@ static int dwc3_gadget_ep_enable(struct usb_ep *ep, dep = to_dwc3_ep(ep); dwc = dep->dwc; - if (dep->flags & DWC3_EP_ENABLED) { - dev_WARN_ONCE(dwc->dev, true, "%s is already enabled\n", - dep->name); + if (dev_WARN_ONCE(dwc->dev, dep->flags & DWC3_EP_ENABLED, + "%s is already enabled\n", + dep->name)) return 0; - } spin_lock_irqsave(&dwc->lock, flags); ret = __dwc3_gadget_ep_enable(dep, desc, ep->comp_desc, false, false); @@ -689,11 +688,10 @@ static int dwc3_gadget_ep_disable(struct usb_ep *ep) dep = to_dwc3_ep(ep); dwc = dep->dwc; - if (!(dep->flags & DWC3_EP_ENABLED)) { - dev_WARN_ONCE(dwc->dev, true, "%s is already disabled\n", - dep->name); + if (dev_WARN_ONCE(dwc->dev, !(dep->flags & DWC3_EP_ENABLED), + "%s is already disabled\n", + dep->name)) return 0; - } spin_lock_irqsave(&dwc->lock, flags); ret = __dwc3_gadget_ep_disable(dep);