Commit 95ca961c authored by Felipe Balbi's avatar Felipe Balbi

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: default avatarFelipe Balbi <balbi@ti.com>
parent 855ed04a
...@@ -661,11 +661,10 @@ static int dwc3_gadget_ep_enable(struct usb_ep *ep, ...@@ -661,11 +661,10 @@ static int dwc3_gadget_ep_enable(struct usb_ep *ep,
dep = to_dwc3_ep(ep); dep = to_dwc3_ep(ep);
dwc = dep->dwc; dwc = dep->dwc;
if (dep->flags & DWC3_EP_ENABLED) { if (dev_WARN_ONCE(dwc->dev, dep->flags & DWC3_EP_ENABLED,
dev_WARN_ONCE(dwc->dev, true, "%s is already enabled\n", "%s is already enabled\n",
dep->name); dep->name))
return 0; return 0;
}
spin_lock_irqsave(&dwc->lock, flags); spin_lock_irqsave(&dwc->lock, flags);
ret = __dwc3_gadget_ep_enable(dep, desc, ep->comp_desc, false, false); 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) ...@@ -689,11 +688,10 @@ static int dwc3_gadget_ep_disable(struct usb_ep *ep)
dep = to_dwc3_ep(ep); dep = to_dwc3_ep(ep);
dwc = dep->dwc; dwc = dep->dwc;
if (!(dep->flags & DWC3_EP_ENABLED)) { if (dev_WARN_ONCE(dwc->dev, !(dep->flags & DWC3_EP_ENABLED),
dev_WARN_ONCE(dwc->dev, true, "%s is already disabled\n", "%s is already disabled\n",
dep->name); dep->name))
return 0; return 0;
}
spin_lock_irqsave(&dwc->lock, flags); spin_lock_irqsave(&dwc->lock, flags);
ret = __dwc3_gadget_ep_disable(dep); ret = __dwc3_gadget_ep_disable(dep);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment