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>
This commit is contained in:
Leonid Lobachev
2019-09-23 13:55:29 -07:00
parent bcf565dc81
commit 3ef19e3777

View File

@@ -636,9 +636,10 @@ static void gasket_perform_unmapping(struct gasket_page_table *pg_tbl,
/* 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;
}