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>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
               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();
        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);