summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@linux.intel.com>2016-04-04 09:11:51 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-04-18 15:23:39 +0300
commitc0ca324d09a041ab56be1aaeb5a7cc64c47f877b (patch)
treec39c2499819931c5c85fafcd96f561f0f1cad641 /drivers/usb/dwc3
parente4875bd4829c1a945bc4714ca806a823a169f3a1 (diff)
usb: dwc3: gadget: combine return points into a single one
dwc3_send_gadget_ep_cmd() had three return points. That becomes a pain to track when we need to debug something or if we need to add more code before returning. Let's combine all three return points into a single one just by introducing a local 'ret' variable. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/gadget.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 93b96fffe0e4..eb760b275004 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -227,6 +227,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
struct dwc3_ep *dep = dwc->eps[ep];
u32 timeout = 500;
u32 reg;
+ int ret = -EINVAL;
trace_dwc3_gadget_ep_cmd(dep, cmd, params);
@@ -242,8 +243,9 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
"Command Complete --> %d",
DWC3_DEPCMD_STATUS(reg));
if (DWC3_DEPCMD_STATUS(reg))
- return -EINVAL;
- return 0;
+ break;
+ ret = 0;
+ break;
}
/*
@@ -254,11 +256,14 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
if (!timeout) {
dwc3_trace(trace_dwc3_gadget,
"Command Timed Out");
- return -ETIMEDOUT;
+ ret = -ETIMEDOUT;
+ break;
}
udelay(1);
} while (1);
+
+ return ret;
}
static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep,