summaryrefslogtreecommitdiff
path: root/drivers/staging/emxx_udc
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2014-09-12 10:04:43 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-19 15:36:25 -0700
commitf39f87e9ea944ca07b53d8261ba60bfbf4f097da (patch)
treeb2f8014cd3c9bc232cc49f165f5146eef545520c /drivers/staging/emxx_udc
parentd5733baf238533e9df41d92948e1ace5e0eae1de (diff)
staging: comedi: adl_pci9118: don't overallocate DMA buffer
The last parameter of `__get_free_pages()` is log2 (the 'order') of the number of pages to be allocated. This driver seems to think it is the linear number of pages, so `pci9118_alloc_dma()` first tries to allocate 16 pages, but only uses 4 of them, setting the buffer size to PAGE_SIZE multiplied by the 'order'. If the allocation fails, it tries progressively smaller orders, down to 0. If the allocation at order 0 succeeds, the buffer size is set to 0, which is likely to cause problems. Set the buffer size to `PAGE_SIZE` shifted left by the allocation order. Since the maximum buffer size previously used was 4, start with an allocation order of 2 instead of 4. Rename the `pages` member of `struct pci9118_dmabuf` (and the local variable in `pci9118_alloc_dma()`) to `order` to make it clearer what it is. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/emxx_udc')
0 files changed, 0 insertions, 0 deletions