diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2012-12-17 18:59:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-17 20:15:13 -0500 |
commit | afde3be121efcc658e26f8cc71ead04af96d38f9 (patch) | |
tree | 1bc661c87dcdade8fe84ec291cca19704b6d7e6a /drivers/dma | |
parent | 632fd28326c0cc7be9c51ea0d76d8bec39a695e9 (diff) |
dmatest: check for dma mapping error
The kernel emits a warning if CONFIG_DMA_API_DEBUG=y:
WARNING: at lib/dma-debug.c:933 check_unmap+0x5d6/0x6ac()
dw_dmac dw_dmac.0: DMA-API: device driver failed to check map error[device address=0x0000000035698305] [size=14365 bytes] [mapped as single]
Fix this by adding the required checking of the dma_map_single() return
value.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/dmatest.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index 6be893baadd9..64b048d7fba7 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c | |||
@@ -367,15 +367,35 @@ static int dmatest_func(void *data) | |||
367 | 367 | ||
368 | dma_srcs[i] = dma_map_single(dev->dev, buf, len, | 368 | dma_srcs[i] = dma_map_single(dev->dev, buf, len, |
369 | DMA_TO_DEVICE); | 369 | DMA_TO_DEVICE); |
370 | ret = dma_mapping_error(dev->dev, dma_srcs[i]); | ||
371 | if (ret) { | ||
372 | unmap_src(dev->dev, dma_srcs, len, i); | ||
373 | pr_warn("%s: #%u: mapping error %d with " | ||
374 | "src_off=0x%x len=0x%x\n", | ||
375 | thread_name, total_tests - 1, ret, | ||
376 | src_off, len); | ||
377 | failed_tests++; | ||
378 | continue; | ||
379 | } | ||
370 | } | 380 | } |
371 | /* map with DMA_BIDIRECTIONAL to force writeback/invalidate */ | 381 | /* map with DMA_BIDIRECTIONAL to force writeback/invalidate */ |
372 | for (i = 0; i < dst_cnt; i++) { | 382 | for (i = 0; i < dst_cnt; i++) { |
373 | dma_dsts[i] = dma_map_single(dev->dev, thread->dsts[i], | 383 | dma_dsts[i] = dma_map_single(dev->dev, thread->dsts[i], |
374 | test_buf_size, | 384 | test_buf_size, |
375 | DMA_BIDIRECTIONAL); | 385 | DMA_BIDIRECTIONAL); |
386 | ret = dma_mapping_error(dev->dev, dma_dsts[i]); | ||
387 | if (ret) { | ||
388 | unmap_src(dev->dev, dma_srcs, len, src_cnt); | ||
389 | unmap_dst(dev->dev, dma_dsts, test_buf_size, i); | ||
390 | pr_warn("%s: #%u: mapping error %d with " | ||
391 | "dst_off=0x%x len=0x%x\n", | ||
392 | thread_name, total_tests - 1, ret, | ||
393 | dst_off, test_buf_size); | ||
394 | failed_tests++; | ||
395 | continue; | ||
396 | } | ||
376 | } | 397 | } |
377 | 398 | ||
378 | |||
379 | if (thread->type == DMA_MEMCPY) | 399 | if (thread->type == DMA_MEMCPY) |
380 | tx = dev->device_prep_dma_memcpy(chan, | 400 | tx = dev->device_prep_dma_memcpy(chan, |
381 | dma_dsts[0] + dst_off, | 401 | dma_dsts[0] + dst_off, |