[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1450741676-5865-26-git-send-email-viro@ZenIV.linux.org.uk>
Date: Mon, 21 Dec 2015 23:46:59 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: linux-kernel@...r.kernel.org
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [POC][PATCH 26/83] dma_4v_alloc_coherent(): don't mix virtual and physical addresses
From: Al Viro <viro@...iv.linux.org.uk>
Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
arch/sparc/kernel/pci_sun4v.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 3eb8907..3ea1937 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -151,8 +151,8 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size,
if (unlikely(!page))
return NULL;
- first_page = (unsigned long) page_address(page);
- memset((char *)first_page, 0, PAGE_SIZE << order);
+ ret = page_address(page);
+ memset(ret, 0, PAGE_SIZE << order);
iommu = dev->archdata.iommu;
@@ -163,8 +163,7 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size,
goto range_alloc_fail;
*dma_addrp = (iommu->tbl.table_map_base + (entry << IO_PAGE_SHIFT));
- ret = (void *) first_page;
- first_page = __pa(first_page);
+ first_page = __pa(ret);
local_irq_save(flags);
@@ -190,7 +189,7 @@ iommu_map_fail:
iommu_tbl_range_free(&iommu->tbl, *dma_addrp, npages, IOMMU_ERROR_CODE);
range_alloc_fail:
- free_pages((void *)first_page, order);
+ free_pages(ret, order);
return NULL;
}
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists