summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2012-05-31 10:29:49 +0300
committerFelipe Balbi <balbi@ti.com>2012-06-03 23:08:27 +0300
commitef21ede65ee3e0dfd8f2cb37de8892816e2f1257 (patch)
treeeb66039a091b94d660b088fe73813e413f6accfa
parent5cbe8c220c1e126dd0855ad57fe4491b267132b9 (diff)
downloadlinux-ef21ede65ee3e0dfd8f2cb37de8892816e2f1257.tar.bz2
usb: dwc3: ep0: simplify error handling on dwc3_ep0_inspect_setup
There's no need for returning early. Instead, we can call dwc3_ep0_stall_and_restart() conditionally. Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/dwc3/ep0.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index e31bcd65e7ec..83fcf392dda7 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -641,11 +641,11 @@ static void dwc3_ep0_inspect_setup(struct dwc3 *dwc,
const struct dwc3_event_depevt *event)
{
struct usb_ctrlrequest *ctrl = dwc->ctrl_req;
- int ret;
+ int ret = -EINVAL;
u32 len;
if (!dwc->gadget_driver)
- goto err;
+ goto out;
len = le16_to_cpu(ctrl->wLength);
if (!len) {
@@ -666,11 +666,9 @@ static void dwc3_ep0_inspect_setup(struct dwc3 *dwc,
if (ret == USB_GADGET_DELAYED_STATUS)
dwc->delayed_status = true;
- if (ret >= 0)
- return;
-
-err:
- dwc3_ep0_stall_and_restart(dwc);
+out:
+ if (ret < 0)
+ dwc3_ep0_stall_and_restart(dwc);
}
static void dwc3_ep0_complete_data(struct dwc3 *dwc,