x86: Calgary: Remove unnecessary DMA_ERROR_CODE usage
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Sun, 15 Nov 2009 12:19:54 +0000 (21:19 +0900)
committerIngo Molnar <mingo@elte.hu>
Tue, 17 Nov 2009 06:53:21 +0000 (07:53 +0100)
This cleans up iommu_alloc() a bit and removes unnecessary
DMA_ERROR_CODE usage.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: muli@il.ibm.com
Cc: joerg.roedel@amd.com
LKML-Reference: <1258287594-8777-4-git-send-email-fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/pci-calgary_64.c

index af9f436096a20f006d309b97ef4ad52780ad84e5..849a0995d97090cd95e359c254b37efd3a25b819 100644 (file)
@@ -261,12 +261,15 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
                              void *vaddr, unsigned int npages, int direction)
 {
        unsigned long entry;
-       dma_addr_t ret = DMA_ERROR_CODE;
+       dma_addr_t ret;
 
        entry = iommu_range_alloc(dev, tbl, npages);
 
-       if (unlikely(entry == DMA_ERROR_CODE))
-               goto error;
+       if (unlikely(entry == DMA_ERROR_CODE)) {
+               printk(KERN_WARNING "Calgary: failed to allocate %u pages in "
+                      "iommu %p\n", npages, tbl);
+               return DMA_ERROR_CODE;
+       }
 
        /* set the return dma address */
        ret = (entry << PAGE_SHIFT) | ((unsigned long)vaddr & ~PAGE_MASK);
@@ -274,13 +277,7 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
        /* put the TCEs in the HW table */
        tce_build(tbl, entry, npages, (unsigned long)vaddr & PAGE_MASK,
                  direction);
-
        return ret;
-
-error:
-       printk(KERN_WARNING "Calgary: failed to allocate %u pages in "
-              "iommu %p\n", npages, tbl);
-       return DMA_ERROR_CODE;
 }
 
 static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,