From 3ef19e3777edb3c5194dddf6afe3fe68293fb306 Mon Sep 17 00:00:00 2001 From: Leonid Lobachev Date: Mon, 23 Sep 2019 13:55:29 -0700 Subject: [PATCH] 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 Signed-off-by: Todd Poynor --- gasket_page_table.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gasket_page_table.c b/gasket_page_table.c index 33672ee..28b0042 100644 --- a/gasket_page_table.c +++ b/gasket_page_table.c @@ -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; }