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>
This commit is contained in:
Paul Zimmerman 2013-11-22 16:43:45 -08:00 committed by Greg Kroah-Hartman
parent beb7e592bc
commit 9bda1aac6b
2 changed files with 7 additions and 7 deletions

View file

@ -369,7 +369,7 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg,
dwc2_hcd_qtd_init(qtd, urb); dwc2_hcd_qtd_init(qtd, urb);
retval = dwc2_hcd_qtd_add(hsotg, qtd, (struct dwc2_qh **)ep_handle, retval = dwc2_hcd_qtd_add(hsotg, qtd, (struct dwc2_qh **)ep_handle,
mem_flags); mem_flags);
if (retval < 0) { if (retval) {
dev_err(hsotg->dev, dev_err(hsotg->dev,
"DWC OTG HCD URB Enqueue failed adding QTD. Error status %d\n", "DWC OTG HCD URB Enqueue failed adding QTD. Error status %d\n",
retval); retval);
@ -378,7 +378,7 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg,
} }
intr_mask = readl(hsotg->regs + GINTMSK); intr_mask = readl(hsotg->regs + GINTMSK);
if (!(intr_mask & GINTSTS_SOF) && retval == 0) { if (!(intr_mask & GINTSTS_SOF)) {
enum dwc2_transaction_type tr_type; enum dwc2_transaction_type tr_type;
if (qtd->qh->ep_type == USB_ENDPOINT_XFER_BULK && 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); spin_unlock_irqrestore(&hsotg->lock, flags);
} }
return retval; return 0;
} }
/* Must be called with interrupt disabled and spinlock held */ /* Must be called with interrupt disabled and spinlock held */

View file

@ -354,7 +354,7 @@ static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
return i; 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; continue;
} }
} }
return -1; return -ENOSPC;
} }
static int dwc2_find_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) 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; frame = status - 1;
/* Set the new frame up */ /* Set the new frame up */
if (frame > -1) { if (frame >= 0) {
qh->sched_frame &= ~0x7; qh->sched_frame &= ~0x7;
qh->sched_frame |= (frame & 7); qh->sched_frame |= (frame & 7);
} }
if (status != -1) if (status > 0)
status = 0; status = 0;
} else { } else {
status = dwc2_periodic_channel_available(hsotg); status = dwc2_periodic_channel_available(hsotg);