Skip to content

Commit

Permalink
staging: comedi: adl_pci9118: don't allocate 2nd DMA buffer on failure
Browse files Browse the repository at this point in the history
`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: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Sep 19, 2014
1 parent 27f5a85 commit d5733ba
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/staging/comedi/drivers/adl_pci9118.c
Original file line number Diff line number Diff line change
Expand Up @@ -1489,16 +1489,16 @@ static void pci9118_alloc_dma(struct comedi_device *dev)
if (dmabuf->virt)
break;
}
if (dmabuf->virt) {
dmabuf->pages = pages;
dmabuf->size = PAGE_SIZE * pages;
dmabuf->hw = virt_to_bus((void *)dmabuf->virt);

if (i == 0)
devpriv->master = 1;
if (i == 1)
devpriv->dma_doublebuf = 1;
}
if (!dmabuf->virt)
break;
dmabuf->pages = pages;
dmabuf->size = PAGE_SIZE * pages;
dmabuf->hw = virt_to_bus((void *)dmabuf->virt);

if (i == 0)
devpriv->master = 1;
if (i == 1)
devpriv->dma_doublebuf = 1;
}
}

Expand Down

0 comments on commit d5733ba

Please sign in to comment.