[PATCH] ioatdma: check dma_mapping_error in ioat_dma_self_test

From: Kyle McMartin
Date: Sat May 25 2013 - 12:54:49 EST


Not checking dma_mapping_error on these dma_map_single uses keeps
showing up in our test runs with DMA-API debugging enabled.

[ 19.744756] ioatdma: Intel(R) QuickData Technology Driver 4.00
[ 19.748979] ------------[ cut here ]------------
[ 19.748991] WARNING: at lib/dma-debug.c:933 check_unmap+0x407/0x8a0()

Signed-off-by: Kyle McMartin <kyle@xxxxxxxxxx>

--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -832,7 +832,17 @@ int ioat_dma_self_test(struct ioatdma_device *device)
}

dma_src = dma_map_single(dev, src, IOAT_TEST_SIZE, DMA_TO_DEVICE);
+ if (dma_mapping_error(dev, dma_src)) {
+ err = -ENODEV;
+ goto free_resources;
+ }
dma_dest = dma_map_single(dev, dest, IOAT_TEST_SIZE, DMA_FROM_DEVICE);
+ if (dma_mapping_error(dev, dma_dest)) {
+ err = -ENODEV;
+ dma_unmap_single(dev, dma_src, IOAT_TEST_SIZE, DMA_TO_DEVICE);
+ goto free_resources;
+ }
+
flags = DMA_COMPL_SKIP_SRC_UNMAP | DMA_COMPL_SKIP_DEST_UNMAP |
DMA_PREP_INTERRUPT;
tx = device->common.device_prep_dma_memcpy(dma_chan, dma_dest, dma_src,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/