Commit d5733baf authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: adl_pci9118: don't allocate 2nd DMA buffer on failure

`pci9118_alloc_dma()` tries to allocate two DMA buffers but may allocate
a single buffer or none at all.  If it fails to allocate the first
buffer, it still tries to allocate the second buffer, even though it
won't be used.  Change it to not bother trying to allocate the second
buffer if the first one fails.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 27f5a85f
......@@ -1489,7 +1489,8 @@ static void pci9118_alloc_dma(struct comedi_device *dev)
if (dmabuf->virt)
break;
}
if (dmabuf->virt) {
if (!dmabuf->virt)
break;
dmabuf->pages = pages;
dmabuf->size = PAGE_SIZE * pages;
dmabuf->hw = virt_to_bus((void *)dmabuf->virt);
......@@ -1499,7 +1500,6 @@ static void pci9118_alloc_dma(struct comedi_device *dev)
if (i == 1)
devpriv->dma_doublebuf = 1;
}
}
}
static void pci9118_free_dma(struct comedi_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment