Commit 522d9744 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Vinod Koul

ioat: add missing DMA unmap to ioat_dma_self_test()

Make ioat_dma_self_test() do DMA unmapping itself and fix handling
of failure cases.

Cc: Dan Williams <djbw@fb.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarDan Williams <djbw@fb.com>
parent 35fa4dbc
...@@ -833,14 +833,14 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device) ...@@ -833,14 +833,14 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device)
dma_src = dma_map_single(dev, src, IOAT_TEST_SIZE, DMA_TO_DEVICE); dma_src = dma_map_single(dev, src, IOAT_TEST_SIZE, DMA_TO_DEVICE);
dma_dest = dma_map_single(dev, dest, IOAT_TEST_SIZE, DMA_FROM_DEVICE); dma_dest = dma_map_single(dev, dest, IOAT_TEST_SIZE, DMA_FROM_DEVICE);
flags = DMA_COMPL_SRC_UNMAP_SINGLE | DMA_COMPL_DEST_UNMAP_SINGLE | flags = DMA_COMPL_SKIP_SRC_UNMAP | DMA_COMPL_SKIP_DEST_UNMAP |
DMA_PREP_INTERRUPT; DMA_PREP_INTERRUPT;
tx = device->common.device_prep_dma_memcpy(dma_chan, dma_dest, dma_src, tx = device->common.device_prep_dma_memcpy(dma_chan, dma_dest, dma_src,
IOAT_TEST_SIZE, flags); IOAT_TEST_SIZE, flags);
if (!tx) { if (!tx) {
dev_err(dev, "Self-test prep failed, disabling\n"); dev_err(dev, "Self-test prep failed, disabling\n");
err = -ENODEV; err = -ENODEV;
goto free_resources; goto unmap_dma;
} }
async_tx_ack(tx); async_tx_ack(tx);
...@@ -851,7 +851,7 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device) ...@@ -851,7 +851,7 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device)
if (cookie < 0) { if (cookie < 0) {
dev_err(dev, "Self-test setup failed, disabling\n"); dev_err(dev, "Self-test setup failed, disabling\n");
err = -ENODEV; err = -ENODEV;
goto free_resources; goto unmap_dma;
} }
dma->device_issue_pending(dma_chan); dma->device_issue_pending(dma_chan);
...@@ -862,7 +862,7 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device) ...@@ -862,7 +862,7 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device)
!= DMA_SUCCESS) { != DMA_SUCCESS) {
dev_err(dev, "Self-test copy timed out, disabling\n"); dev_err(dev, "Self-test copy timed out, disabling\n");
err = -ENODEV; err = -ENODEV;
goto free_resources; goto unmap_dma;
} }
if (memcmp(src, dest, IOAT_TEST_SIZE)) { if (memcmp(src, dest, IOAT_TEST_SIZE)) {
dev_err(dev, "Self-test copy failed compare, disabling\n"); dev_err(dev, "Self-test copy failed compare, disabling\n");
...@@ -870,6 +870,9 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device) ...@@ -870,6 +870,9 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device)
goto free_resources; goto free_resources;
} }
unmap_dma:
dma_unmap_single(dev, dma_src, IOAT_TEST_SIZE, DMA_TO_DEVICE);
dma_unmap_single(dev, dma_dest, IOAT_TEST_SIZE, DMA_FROM_DEVICE);
free_resources: free_resources:
dma->device_free_chan_resources(dma_chan); dma->device_free_chan_resources(dma_chan);
out: out:
......
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