summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>2013-11-25 13:42:45 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-03 08:31:08 -0800
commit0b851be2737fa7533facfbf3be46678d180fee80 (patch)
treee8cb7e009c5299f8f3b04acfb813e026576c4788
parent54216acee5a408411ca23e727a5315ace5acf0c4 (diff)
staging: dwc2: fix thinko in dwc2_fill_host_dma_desc()
The check against MAX_DMA_DESC_SIZE didn't make sense, fix it Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/dwc2/hcd_ddma.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/dwc2/hcd_ddma.c b/drivers/staging/dwc2/hcd_ddma.c
index 72e9788c1a13..3376177e4d3c 100644
--- a/drivers/staging/dwc2/hcd_ddma.c
+++ b/drivers/staging/dwc2/hcd_ddma.c
@@ -621,8 +621,8 @@ static void dwc2_fill_host_dma_desc(struct dwc2_hsotg *hsotg,
struct dwc2_hcd_dma_desc *dma_desc = &qh->desc_list[n_desc];
int len = chan->xfer_len;
- if (len > MAX_DMA_DESC_SIZE)
- len = MAX_DMA_DESC_SIZE - chan->max_packet + 1;
+ if (len > MAX_DMA_DESC_SIZE - (chan->max_packet - 1))
+ len = MAX_DMA_DESC_SIZE - (chan->max_packet - 1);
if (chan->ep_is_in) {
int num_packets;