Skip to content

Commit

Permalink
usb: dwc3: ep0: simplify error handling on dwc3_ep0_inspect_setup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Felipe Balbi committed Jun 3, 2012
1 parent 5cbe8c2 commit ef21ede
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions drivers/usb/dwc3/ep0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit ef21ede

Please sign in to comment.