提交 e9166139 编写于 作者: I Ian Abbott 提交者: Greg Kroah-Hartman

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: NIan Abbott <abbotti@mev.co.uk>
Reviewed-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 bd304a73
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册