[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1412108121-19262-1-git-send-email-seanpaul@chromium.org>
Date: Tue, 30 Sep 2014 16:15:21 -0400
From: Sean Paul <seanpaul@...omium.org>
To: catalin.marinas@....com, will.deacon@....com,
lauraa@...eaurora.org, ritesh.harjani@...il.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: olof@...om.net, seanpaul@...omium.org
Subject: [PATCH] arm64: Use and error-check DMA_ERROR_CODE
This patch replaces the static assignment of ~0 to dma_handle with
DMA_ERROR_CODE to be consistent with other platforms.
In addition to that, it also adds a check for DMA_ERROR_CODE before
calling __dma_free_coherent with an invalid dma_handle.
Signed-off-by: Sean Paul <seanpaul@...omium.org>
---
arch/arm64/mm/dma-mapping.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 4164c5a..69fd2c4 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -125,7 +125,7 @@ static void *__dma_alloc_noncoherent(struct device *dev, size_t size,
no_map:
__dma_free_coherent(dev, size, ptr, *dma_handle, attrs);
no_mem:
- *dma_handle = ~0;
+ *dma_handle = DMA_ERROR_CODE;
return NULL;
}
@@ -136,7 +136,9 @@ static void __dma_free_noncoherent(struct device *dev, size_t size,
void *swiotlb_addr = phys_to_virt(dma_to_phys(dev, dma_handle));
vunmap(vaddr);
- __dma_free_coherent(dev, size, swiotlb_addr, dma_handle, attrs);
+
+ if (dma_handle != DMA_ERROR_CODE)
+ __dma_free_coherent(dev, size, swiotlb_addr, dma_handle, attrs);
}
static dma_addr_t __swiotlb_map_page(struct device *dev, struct page *page,
--
2.1.1
--
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