Skip to content

Commit

Permalink
staging: comedi: complain if dma buffer allocation not supported
Browse files Browse the repository at this point in the history
When allocating a buffer to support asynchronous comedi commands, if a
DMA coherent buffer was requested but `CONFIG_HAS_DMA` is undefined,
bail out of local helper function `__comedi_buf_alloc()` with an error
message.

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>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed May 13, 2013
1 parent bd304a7 commit e916613
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/staging/comedi/comedi_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
struct comedi_buf_page *buf;
unsigned i;

if (!IS_ENABLED(CONFIG_HAS_DMA) && s->async_dma_dir != DMA_NONE) {
dev_err(dev->class_dev,
"dma buffer allocation not supported\n");
return;
}

async->buf_page_list = vzalloc(sizeof(*buf) * n_pages);
if (async->buf_page_list)
pages = vmalloc(sizeof(struct page *) * n_pages);
Expand Down

0 comments on commit e916613

Please sign in to comment.