[PATCH 07/28] x86: use WARN_ON in mapping functions

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Glauber Costa
Date: Tuesday, April 8, 2008 - 9:20 am

In the very same way i386 do, we use WARN_ON functions
in map_simple and map_sg.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 arch/x86/kernel/pci-nommu_64.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/pci-nommu_64.c b/arch/x86/kernel/pci-nommu_64.c
index c6901e7..8d036ae 100644
--- a/arch/x86/kernel/pci-nommu_64.c
+++ b/arch/x86/kernel/pci-nommu_64.c
@@ -30,6 +30,7 @@ nommu_map_single(struct device *hwdev, phys_addr_t paddr, size_t size,
 	       int direction)
 {
 	dma_addr_t bus = paddr;
+	WARN_ON(size == 0);
 	if (!check_addr("map_single", hwdev, bus, size))
 				return bad_dma_address;
 	flush_write_buffers();
@@ -58,6 +59,8 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
 	struct scatterlist *s;
 	int i;
 
+	WARN_ON(nents == 0 || sg[0].length == 0);
+
 	for_each_sg(sg, s, nents, i) {
 		BUG_ON(!sg_page(s));
 		s->dma_address = sg_phys(s);
-- 
1.5.0.6

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/28] integrate dma_ops, Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 01/28] x86: introduce pci-dma.c, Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 05/28] x86: use sg_phys in x86_64, Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 06/28] x86: use dma_length in i386, Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 07/28] x86: use WARN_ON in mapping functions, Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 08/28] x86: move definition to pci-dma.c, Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 10/28] x86: unify pci-nommu, Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 11/28] x86: move pci fixup to pci-dma.c, Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 12/28] x86: move x86_64-specific to common code., Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 13/28] x86: merge dma_supported, Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 16/28] x86: isolate coherent mapping functions, Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 17/28] x86: adjust dma_free_coherent for i386, Glauber Costa, (Tue Apr 8, 9:20 am)
[PATCH 18/28] x86: move bad_dma_address, Glauber Costa, (Tue Apr 8, 9:21 am)
[PATCH 19/28] x86: remove virt_to_bus in pci-dma_64.c, Glauber Costa, (Tue Apr 8, 9:21 am)
[PATCH 20/28] x86: use numa allocation function in i386, Glauber Costa, (Tue Apr 8, 9:21 am)
[PATCH 21/28] x86: retry allocation if failed, Glauber Costa, (Tue Apr 8, 9:21 am)
[PATCH 22/28] x86: use a fallback dev for i386, Glauber Costa, (Tue Apr 8, 9:21 am)
[PATCH 24/28] x86: unify gfp masks, Glauber Costa, (Tue Apr 8, 9:21 am)
[PATCH 25/28] x86: remove kludge from x86_64, Glauber Costa, (Tue Apr 8, 9:21 am)
[PATCH 26/28] x86: return conditional to mmu, Glauber Costa, (Tue Apr 8, 9:21 am)
[PATCH 27/28] x86: don't do dma if mask is NULL., Glauber Costa, (Tue Apr 8, 9:21 am)
[PATCH 28/28] x86: integrate pci-dma.c, Glauber Costa, (Tue Apr 8, 9:21 am)