Commit 5b3e5b72 authored by Glauber Costa's avatar Glauber Costa Committed by Ingo Molnar

x86: use WARN_ON in mapping functions

In the very same way i386 do, we use WARN_ON functions
in map_simple and map_sg.
Signed-off-by: default avatarGlauber Costa <gcosta@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 30db2cbf
...@@ -30,6 +30,7 @@ nommu_map_single(struct device *hwdev, phys_addr_t paddr, size_t size, ...@@ -30,6 +30,7 @@ nommu_map_single(struct device *hwdev, phys_addr_t paddr, size_t size,
int direction) int direction)
{ {
dma_addr_t bus = paddr; dma_addr_t bus = paddr;
WARN_ON(size == 0);
if (!check_addr("map_single", hwdev, bus, size)) if (!check_addr("map_single", hwdev, bus, size))
return bad_dma_address; return bad_dma_address;
flush_write_buffers(); flush_write_buffers();
...@@ -58,6 +59,8 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg, ...@@ -58,6 +59,8 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
struct scatterlist *s; struct scatterlist *s;
int i; int i;
WARN_ON(nents == 0 || sg[0].length == 0);
for_each_sg(sg, s, nents, i) { for_each_sg(sg, s, nents, i) {
BUG_ON(!sg_page(s)); BUG_ON(!sg_page(s));
s->dma_address = sg_phys(s); s->dma_address = sg_phys(s);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment