From: Ian Abbott Date: Fri, 10 May 2013 13:07:16 +0000 (+0100) Subject: staging: comedi: complain if dma buffer allocation not supported X-Git-Tag: MMI-PSA29.97-13-9~14348^2~18 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e9166139f6f829c2e7bf6695f13e08d09303d6ca;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- 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, 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);