]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - drivers/dma/dmatest.c
dmatest: check for dma mapping error
[~shefty/rdma-dev.git] / drivers / dma / dmatest.c
index 6be893baadd9bdf6c82fa2f4d931e7ff905480f1..64b048d7fba751de8f5faf7b73062ea104aeea15 100644 (file)
@@ -367,15 +367,35 @@ static int dmatest_func(void *data)
 
                        dma_srcs[i] = dma_map_single(dev->dev, buf, len,
                                                     DMA_TO_DEVICE);
+                       ret = dma_mapping_error(dev->dev, dma_srcs[i]);
+                       if (ret) {
+                               unmap_src(dev->dev, dma_srcs, len, i);
+                               pr_warn("%s: #%u: mapping error %d with "
+                                       "src_off=0x%x len=0x%x\n",
+                                       thread_name, total_tests - 1, ret,
+                                       src_off, len);
+                               failed_tests++;
+                               continue;
+                       }
                }
                /* map with DMA_BIDIRECTIONAL to force writeback/invalidate */
                for (i = 0; i < dst_cnt; i++) {
                        dma_dsts[i] = dma_map_single(dev->dev, thread->dsts[i],
                                                     test_buf_size,
                                                     DMA_BIDIRECTIONAL);
+                       ret = dma_mapping_error(dev->dev, dma_dsts[i]);
+                       if (ret) {
+                               unmap_src(dev->dev, dma_srcs, len, src_cnt);
+                               unmap_dst(dev->dev, dma_dsts, test_buf_size, i);
+                               pr_warn("%s: #%u: mapping error %d with "
+                                       "dst_off=0x%x len=0x%x\n",
+                                       thread_name, total_tests - 1, ret,
+                                       dst_off, test_buf_size);
+                               failed_tests++;
+                               continue;
+                       }
                }
 
-
                if (thread->type == DMA_MEMCPY)
                        tx = dev->device_prep_dma_memcpy(chan,
                                                         dma_dsts[0] + dst_off,