public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kyle McMartin <kyle@redhat.com>
To: djbw@fb.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] ioatdma: check dma_mapping_error in ioat_dma_self_test
Date: Sat, 25 May 2013 12:54:38 -0400	[thread overview]
Message-ID: <20130525165437.GD30204@redacted.bos.redhat.com> (raw)

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@redhat.com>

--- 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,

                 reply	other threads:[~2013-05-25 16:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130525165437.GD30204@redacted.bos.redhat.com \
    --to=kyle@redhat.com \
    --cc=djbw@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox