aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/usb/host/xhci-mem.c
diff options
context:
space:
mode:
authorHimanshu Jha <himanshujha199640@gmail.com>2017-12-31 01:33:52 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-04 17:03:15 +0100
commit2b80a29bf83d2baed1a22193647bafcc6a0426af (patch)
tree7081bb3902ffa221224dad0f160af26690b15cf3 /drivers/usb/host/xhci-mem.c
parentuwb: remove trailing whitespace for coding style (diff)
downloadwireguard-linux-2b80a29bf83d2baed1a22193647bafcc6a0426af.tar.xz
wireguard-linux-2b80a29bf83d2baed1a22193647bafcc6a0426af.zip
USB: host: Use zeroing memory allocator rather than allocator/memset
Use dma_zalloc_coherent for allocating zeroed memory and remove unnecessary memset function. Done using Coccinelle. Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci 0-day tested with no failures. Suggested-by: Luis R. Rodriguez <mcgrof@kernel.org> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r--drivers/usb/host/xhci-mem.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 554a8a517a33..332420d10be9 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1782,14 +1782,11 @@ int xhci_alloc_erst(struct xhci_hcd *xhci,
struct xhci_erst_entry *entry;
size = sizeof(struct xhci_erst_entry) * evt_ring->num_segs;
- erst->entries = dma_alloc_coherent(xhci_to_hcd(xhci)->self.sysdev,
- size,
- &erst->erst_dma_addr,
- flags);
+ erst->entries = dma_zalloc_coherent(xhci_to_hcd(xhci)->self.sysdev,
+ size, &erst->erst_dma_addr, flags);
if (!erst->entries)
return -ENOMEM;
- memset(erst->entries, 0, size);
erst->num_entries = evt_ring->num_segs;
seg = evt_ring->first_seg;