diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2013-05-10 09:07:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-05-13 17:38:48 -0400 |
commit | e9166139f6f829c2e7bf6695f13e08d09303d6ca (patch) | |
tree | fedc60a4cc8493b508a3432d915c9f01b554b3f7 /drivers/staging | |
parent | bd304a736afd99cc38bad4d1628e8e2d05d308d5 (diff) |
staging: comedi: complain if dma buffer allocation not supported
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/comedi/comedi_buf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index b6cd67ad55d1..d4be0e68509b 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c | |||
@@ -76,6 +76,12 @@ static void __comedi_buf_alloc(struct comedi_device *dev, | |||
76 | struct comedi_buf_page *buf; | 76 | struct comedi_buf_page *buf; |
77 | unsigned i; | 77 | unsigned i; |
78 | 78 | ||
79 | if (!IS_ENABLED(CONFIG_HAS_DMA) && s->async_dma_dir != DMA_NONE) { | ||
80 | dev_err(dev->class_dev, | ||
81 | "dma buffer allocation not supported\n"); | ||
82 | return; | ||
83 | } | ||
84 | |||
79 | async->buf_page_list = vzalloc(sizeof(*buf) * n_pages); | 85 | async->buf_page_list = vzalloc(sizeof(*buf) * n_pages); |
80 | if (async->buf_page_list) | 86 | if (async->buf_page_list) |
81 | pages = vmalloc(sizeof(struct page *) * n_pages); | 87 | pages = vmalloc(sizeof(struct page *) * n_pages); |