Skip to content

Commit

Permalink
staging: comedi: addi_apci_3120: don't allocate 2nd DMA buffer on fai…
Browse files Browse the repository at this point in the history
…lure

`apci3120_auto_attach()` 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 aee4475 commit df567fe
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions drivers/staging/comedi/drivers/addi_apci_3120.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@ static int apci3120_auto_attach(struct comedi_device *dev,
if (devpriv->ul_DmaBufferVirtual[i])
break;
}
if (devpriv->ul_DmaBufferVirtual[i]) {
devpriv->ui_DmaBufferPages[i] = pages;
devpriv->ui_DmaBufferSize[i] = PAGE_SIZE * pages;
devpriv->ul_DmaBufferHw[i] =
virt_to_bus((void *)devpriv->
ul_DmaBufferVirtual[i]);
}
if (!devpriv->ul_DmaBufferVirtual[i])
break;
devpriv->ui_DmaBufferPages[i] = pages;
devpriv->ui_DmaBufferSize[i] = PAGE_SIZE * pages;
devpriv->ul_DmaBufferHw[i] =
virt_to_bus(devpriv->ul_DmaBufferVirtual[i]);
}
if (!devpriv->ul_DmaBufferVirtual[0])
devpriv->us_UseDma = 0;
Expand Down

0 comments on commit df567fe

Please sign in to comment.