[PATCH 06/10] staging: gasket: page_table: don't unmap coherent pages

From: Todd Poynor
Date: Mon Sep 17 2018 - 08:39:55 EST


From: Nick Ewalt <nicholasewalt@xxxxxxxxxx>

Only call dma_unmap_page if there was an associated dma_map_page call.

Signed-off-by: Nick Ewalt <nicholasewalt@xxxxxxxxxx>
Signed-off-by: Todd Poynor <toddpoynor@xxxxxxxxxx>
---
drivers/staging/gasket/gasket_page_table.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c
index 8fe27e7d1b53c..33d98043953a5 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -610,7 +610,7 @@ static void gasket_perform_unmapping(struct gasket_page_table *pg_tbl,

/* release the address from the driver, */
if (ptes[i].status == PTE_INUSE) {
- if (ptes[i].dma_addr) {
+ if (ptes[i].page && ptes[i].dma_addr) {
dma_unmap_page(pg_tbl->device, ptes[i].dma_addr,
PAGE_SIZE, DMA_BIDIRECTIONAL);
}
--
2.19.0.397.gdd90340f6a-goog