summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2014-09-12 11:19:54 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-19 22:39:39 (GMT)
commitdf567feb00277ddee715f61e4616eaae50532ea0 (patch)
tree4582598068bdb772d57ea28c6ad641f8ab265d32 /drivers/staging
parentaee447566d08b7b0da482c4a9d8dc7a8332e4d69 (diff)
downloadlinux-df567feb00277ddee715f61e4616eaae50532ea0.tar.xz
staging: comedi: addi_apci_3120: don't allocate 2nd DMA buffer on failure
`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>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/comedi/drivers/addi_apci_3120.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c
index 84501a3..2ac95ba 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3120.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
@@ -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;