Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: host: xhci: delete sp_dma_buffers for scratchpad

We already have sp_array to store each scratch buffer address for xHC,
it doesn't need another sp_dma_buffers array to store it.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Peter Chen and committed by
Greg Kroah-Hartman
314eaf7d 724e882d

+4 -15
+4 -14
drivers/usb/host/xhci-mem.c
··· 1721 1721 if (!xhci->scratchpad->sp_buffers) 1722 1722 goto fail_sp3; 1723 1723 1724 - xhci->scratchpad->sp_dma_buffers = 1725 - kzalloc(sizeof(dma_addr_t) * num_sp, flags); 1726 - 1727 - if (!xhci->scratchpad->sp_dma_buffers) 1728 - goto fail_sp4; 1729 - 1730 1724 xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma); 1731 1725 for (i = 0; i < num_sp; i++) { 1732 1726 dma_addr_t dma; 1733 1727 void *buf = dma_alloc_coherent(dev, xhci->page_size, &dma, 1734 1728 flags); 1735 1729 if (!buf) 1736 - goto fail_sp5; 1730 + goto fail_sp4; 1737 1731 1738 1732 xhci->scratchpad->sp_array[i] = dma; 1739 1733 xhci->scratchpad->sp_buffers[i] = buf; 1740 - xhci->scratchpad->sp_dma_buffers[i] = dma; 1741 1734 } 1742 1735 1743 1736 return 0; 1744 1737 1745 - fail_sp5: 1738 + fail_sp4: 1746 1739 for (i = i - 1; i >= 0; i--) { 1747 1740 dma_free_coherent(dev, xhci->page_size, 1748 1741 xhci->scratchpad->sp_buffers[i], 1749 - xhci->scratchpad->sp_dma_buffers[i]); 1742 + xhci->scratchpad->sp_array[i]); 1750 1743 } 1751 - kfree(xhci->scratchpad->sp_dma_buffers); 1752 1744 1753 - fail_sp4: 1754 1745 kfree(xhci->scratchpad->sp_buffers); 1755 1746 1756 1747 fail_sp3: ··· 1771 1780 for (i = 0; i < num_sp; i++) { 1772 1781 dma_free_coherent(dev, xhci->page_size, 1773 1782 xhci->scratchpad->sp_buffers[i], 1774 - xhci->scratchpad->sp_dma_buffers[i]); 1783 + xhci->scratchpad->sp_array[i]); 1775 1784 } 1776 - kfree(xhci->scratchpad->sp_dma_buffers); 1777 1785 kfree(xhci->scratchpad->sp_buffers); 1778 1786 dma_free_coherent(dev, num_sp * sizeof(u64), 1779 1787 xhci->scratchpad->sp_array,
-1
drivers/usb/host/xhci.h
··· 1606 1606 u64 *sp_array; 1607 1607 dma_addr_t sp_dma; 1608 1608 void **sp_buffers; 1609 - dma_addr_t *sp_dma_buffers; 1610 1609 }; 1611 1610 1612 1611 struct urb_priv {