aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/buffer.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-09-03 03:23:41 -0400
committerIngo Molnar <mingo@kernel.org>2019-09-03 03:23:41 -0400
commitae1ad26388228048db6a5f1056bd569ed2bbc4ec (patch)
tree223f50677aa00eb6f2a6529099a1005c7e43c071 /drivers/usb/core/buffer.c
parentc84b82dd3e593db217f23c60f7edae02c76a3c4c (diff)
parent089cf7f6ecb266b6a4164919a2e69bd2f938374a (diff)
Merge tag 'v5.3-rc7' into x86/mm, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/usb/core/buffer.c')
-rw-r--r--drivers/usb/core/buffer.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index 1359b78a624e..6cf22c27f2d2 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -66,9 +66,7 @@ int hcd_buffer_create(struct usb_hcd *hcd)
66 char name[16]; 66 char name[16];
67 int i, size; 67 int i, size;
68 68
69 if (!IS_ENABLED(CONFIG_HAS_DMA) || 69 if (hcd->localmem_pool || !hcd_uses_dma(hcd))
70 (!is_device_dma_capable(hcd->self.sysdev) &&
71 !hcd->localmem_pool))
72 return 0; 70 return 0;
73 71
74 for (i = 0; i < HCD_BUFFER_POOLS; i++) { 72 for (i = 0; i < HCD_BUFFER_POOLS; i++) {
@@ -129,8 +127,7 @@ void *hcd_buffer_alloc(
129 return gen_pool_dma_alloc(hcd->localmem_pool, size, dma); 127 return gen_pool_dma_alloc(hcd->localmem_pool, size, dma);
130 128
131 /* some USB hosts just use PIO */ 129 /* some USB hosts just use PIO */
132 if (!IS_ENABLED(CONFIG_HAS_DMA) || 130 if (!hcd_uses_dma(hcd)) {
133 !is_device_dma_capable(bus->sysdev)) {
134 *dma = ~(dma_addr_t) 0; 131 *dma = ~(dma_addr_t) 0;
135 return kmalloc(size, mem_flags); 132 return kmalloc(size, mem_flags);
136 } 133 }
@@ -160,8 +157,7 @@ void hcd_buffer_free(
160 return; 157 return;
161 } 158 }
162 159
163 if (!IS_ENABLED(CONFIG_HAS_DMA) || 160 if (!hcd_uses_dma(hcd)) {
164 !is_device_dma_capable(bus->sysdev)) {
165 kfree(addr); 161 kfree(addr);
166 return; 162 return;
167 } 163 }