]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
linux/x86: dma_map_sg(): BUG_ON() before use
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 6 Dec 2007 15:48:12 +0000 (15:48 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 6 Dec 2007 15:48:12 +0000 (15:48 +0000)
Signed-off-by: Jan Beulich <jbeulich@novell.com>
arch/i386/kernel/pci-dma-xen.c

index 7fe2e6dd7e0e0eae3830ccd4f9437f3db1235da5..9c8b6435a4d17ed7bff870331c088819037c4cb8 100644 (file)
@@ -91,10 +91,10 @@ dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
                rc = swiotlb_map_sg(hwdev, sg, nents, direction);
        } else {
                for (i = 0; i < nents; i++ ) {
+                       BUG_ON(!sg[i].page);
                        sg[i].dma_address =
                                gnttab_dma_map_page(sg[i].page) + sg[i].offset;
                        sg[i].dma_length  = sg[i].length;
-                       BUG_ON(!sg[i].page);
                        IOMMU_BUG_ON(address_needs_mapping(
                                hwdev, sg[i].dma_address));
                        IOMMU_BUG_ON(range_straddles_page_boundary(