staging: gasket: page_table: don't unmap coherent pages
Only call dma_unmap_page if there was an associated dma_map_page.
Change-Id: I6234719f8ab6b1e5e069c21e2f639eee4f22b039
Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c
index c54220b..0374767 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -636,9 +636,10 @@
/* release the address from the driver, */
if (GET(FLAGS_STATUS, ptes[i].flags) == 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,
- GET(FLAGS_DMA_DIRECTION, ptes[i].flags)); }
+ GET(FLAGS_DMA_DIRECTION, ptes[i].flags));
+ }
if (gasket_release_page(ptes[i].page))
--pg_tbl->num_active_pages;
}