]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
dma-debug: warn of unmapping an invalid dma address
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Thu, 19 Mar 2009 01:39:31 +0000 (10:39 +0900)
committerIngo Molnar <mingo@elte.hu>
Thu, 19 Mar 2009 07:39:48 +0000 (08:39 +0100)
Impact: extend DMA-debug checks

Calling dma_unmap families against an invalid dma address should be a
bug.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Joerg Roedel <joerg.roedel@amd.com>
LKML-Reference: <20090319103743N.fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
lib/dma-debug.c

index 9a350b414a5067c0f9eb905143566e83a85ce03f..f9e6d38b4b341fec618171cae6b46873d2635eb6 100644 (file)
@@ -531,8 +531,11 @@ static void check_unmap(struct dma_debug_entry *ref)
        struct hash_bucket *bucket;
        unsigned long flags;
 
-       if (dma_mapping_error(ref->dev, ref->dev_addr))
+       if (dma_mapping_error(ref->dev, ref->dev_addr)) {
+               err_printk(ref->dev, NULL, "DMA-API: device driver tries "
+                          "to free an invalid DMA memory address\n");
                return;
+       }
 
        bucket = get_hash_bucket(ref, &flags);
        entry = hash_bucket_find(bucket, ref);