diff options
author | Paul Zimmerman <Paul.Zimmerman@synopsys.com> | 2013-11-23 04:43:45 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-11-25 23:59:57 +0400 |
commit | 9bda1aac6b98d79f06df4ae40711bf08d23e766d (patch) | |
tree | 69eb6f662462bae5ba1222bab61fb6cce0631b1f /drivers | |
parent | beb7e592bcfd750951c47580494f13065f0fd44c (diff) | |
download | linux-9bda1aac6b98d79f06df4ae40711bf08d23e766d.tar.xz |
staging: dwc2: fix some functions to return a proper error code
Fix some functions called by dwc2_hcd_qtd_add() to return either
a proper error code or 0, instead of somewhat random values.
Then change the caller of dwc2_hcd_qtd_add() to just check the
return value for 0.
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/dwc2/hcd.c | 6 | ||||
-rw-r--r-- | drivers/staging/dwc2/hcd_queue.c | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/drivers/staging/dwc2/hcd.c b/drivers/staging/dwc2/hcd.c index 3cfd2d5152c9..24a4efe874d6 100644 --- a/drivers/staging/dwc2/hcd.c +++ b/drivers/staging/dwc2/hcd.c @@ -369,7 +369,7 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, dwc2_hcd_qtd_init(qtd, urb); retval = dwc2_hcd_qtd_add(hsotg, qtd, (struct dwc2_qh **)ep_handle, mem_flags); - if (retval < 0) { + if (retval) { dev_err(hsotg->dev, "DWC OTG HCD URB Enqueue failed adding QTD. Error status %d\n", retval); @@ -378,7 +378,7 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, } intr_mask = readl(hsotg->regs + GINTMSK); - if (!(intr_mask & GINTSTS_SOF) && retval == 0) { + if (!(intr_mask & GINTSTS_SOF)) { enum dwc2_transaction_type tr_type; if (qtd->qh->ep_type == USB_ENDPOINT_XFER_BULK && @@ -396,7 +396,7 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, spin_unlock_irqrestore(&hsotg->lock, flags); } - return retval; + return 0; } /* Must be called with interrupt disabled and spinlock held */ diff --git a/drivers/staging/dwc2/hcd_queue.c b/drivers/staging/dwc2/hcd_queue.c index 2f68fbc08827..729cc0b83df3 100644 --- a/drivers/staging/dwc2/hcd_queue.c +++ b/drivers/staging/dwc2/hcd_queue.c @@ -354,7 +354,7 @@ static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) return i; } } - return -1; + return -ENOSPC; } /* @@ -413,7 +413,7 @@ static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) continue; } } - return -1; + return -ENOSPC; } static int dwc2_find_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) @@ -487,12 +487,12 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) frame = status - 1; /* Set the new frame up */ - if (frame > -1) { + if (frame >= 0) { qh->sched_frame &= ~0x7; qh->sched_frame |= (frame & 7); } - if (status != -1) + if (status > 0) status = 0; } else { status = dwc2_periodic_channel_available(hsotg); |