]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
staging: comedi: complain if dma buffer allocation not supported
authorIan Abbott <abbotti@mev.co.uk>
Fri, 10 May 2013 13:07:16 +0000 (14:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 May 2013 21:38:48 +0000 (17:38 -0400)
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>
drivers/staging/comedi/comedi_buf.c

index b6cd67ad55d177f80898c6b1d4c34c766b6300d2..d4be0e68509b7f6a0b54d6bf7c412105349acdc6 100644 (file)
@@ -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);