Skip to contentSkip to conversation

usb: xhci-mem: use passed in GFP flags instead of GFP_KERNEL

PATCH In review Dan Carpenter 2 participants 2 messages Nov 10, 2016 – Nov 11, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: xhci-mem: use passed in GFP flags instead of GFP_KERNEL

We normally use the passed in gfp flags for allocations, it's just these two which were missed.

Fixes 22d45f01a836 ("usb/xhci: replace pci_*_consistent() with dma_*_coherent()")

---
From static analysis. Not tested.

drivers/usb/host/xhci-mem.c +2 -2
index 6afe323..3c4cc29 100644
@@ -2384,7 +2384,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
 	 * "physically contiguous and 64-byte (cache line) aligned".
 	 */
 	xhci->dcbaa = dma_alloc_coherent(dev, sizeof(*xhci->dcbaa), &dma,
-			GFP_KERNEL);
+			flags);
 	if (!xhci->dcbaa)
 		goto fail;
 	memset(xhci->dcbaa, 0, sizeof *(xhci->dcbaa));
@@ -2480,7 +2480,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
 
 	xhci->erst.entries = dma_alloc_coherent(dev,
 			sizeof(struct xhci_erst_entry) * ERST_NUM_SEGS, &dma,
-			GFP_KERNEL);
+			flags);
 	if (!xhci->erst.entries)
 		goto fail;
 	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Dan Carpenter

We normally use the passed in gfp flags for allocations, it's just these two which were missed.

You seem to be right. xhci_mem_init() has only one caller with GFP_KERNEL as argument. You could unwind it.

Quoted 2 lines
Fixes 22d45f01a836 ("usb/xhci: replace pci_*_consistent() with dma_*_coherent()")

Sebastian