aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/host/xhci-mem.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 39f9a99a503b..be7b7b6b5517 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -520,12 +520,12 @@ static void xhci_free_stream_ctx(struct xhci_hcd *xhci,
520 struct xhci_stream_ctx *stream_ctx, dma_addr_t dma) 520 struct xhci_stream_ctx *stream_ctx, dma_addr_t dma)
521{ 521{
522 struct device *dev = xhci_to_hcd(xhci)->self.controller; 522 struct device *dev = xhci_to_hcd(xhci)->self.controller;
523 size_t size = sizeof(struct xhci_stream_ctx) * num_stream_ctxs;
523 524
524 if (num_stream_ctxs > MEDIUM_STREAM_ARRAY_SIZE) 525 if (size > MEDIUM_STREAM_ARRAY_SIZE)
525 dma_free_coherent(dev, 526 dma_free_coherent(dev, size,
526 sizeof(struct xhci_stream_ctx)*num_stream_ctxs,
527 stream_ctx, dma); 527 stream_ctx, dma);
528 else if (num_stream_ctxs <= SMALL_STREAM_ARRAY_SIZE) 528 else if (size <= SMALL_STREAM_ARRAY_SIZE)
529 return dma_pool_free(xhci->small_streams_pool, 529 return dma_pool_free(xhci->small_streams_pool,
530 stream_ctx, dma); 530 stream_ctx, dma);
531 else 531 else
@@ -548,12 +548,12 @@ static struct xhci_stream_ctx *xhci_alloc_stream_ctx(struct xhci_hcd *xhci,
548 gfp_t mem_flags) 548 gfp_t mem_flags)
549{ 549{
550 struct device *dev = xhci_to_hcd(xhci)->self.controller; 550 struct device *dev = xhci_to_hcd(xhci)->self.controller;
551 size_t size = sizeof(struct xhci_stream_ctx) * num_stream_ctxs;
551 552
552 if (num_stream_ctxs > MEDIUM_STREAM_ARRAY_SIZE) 553 if (size > MEDIUM_STREAM_ARRAY_SIZE)
553 return dma_alloc_coherent(dev, 554 return dma_alloc_coherent(dev, size,
554 sizeof(struct xhci_stream_ctx)*num_stream_ctxs,
555 dma, mem_flags); 555 dma, mem_flags);
556 else if (num_stream_ctxs <= SMALL_STREAM_ARRAY_SIZE) 556 else if (size <= SMALL_STREAM_ARRAY_SIZE)
557 return dma_pool_alloc(xhci->small_streams_pool, 557 return dma_pool_alloc(xhci->small_streams_pool,
558 mem_flags, dma); 558 mem_flags, dma);
559 else 559 else