Commit 3457b305 authored by Fuqian Huang's avatar Fuqian Huang Committed by Alex Deucher

drm/ttm: use the same attributes when freeing d_page->vaddr

In function __ttm_dma_alloc_page(), d_page->addr is allocated
by dma_alloc_attrs() but freed with use dma_free_coherent() in
__ttm_dma_free_page().
Use the correct dma_free_attrs() to free d_page->vaddr.
Signed-off-by: default avatarFuqian Huang <huangfq.daxian@gmail.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1a195ed5
...@@ -285,9 +285,13 @@ static int ttm_set_pages_caching(struct dma_pool *pool, ...@@ -285,9 +285,13 @@ static int ttm_set_pages_caching(struct dma_pool *pool,
static void __ttm_dma_free_page(struct dma_pool *pool, struct dma_page *d_page) static void __ttm_dma_free_page(struct dma_pool *pool, struct dma_page *d_page)
{ {
unsigned long attrs = 0;
dma_addr_t dma = d_page->dma; dma_addr_t dma = d_page->dma;
d_page->vaddr &= ~VADDR_FLAG_HUGE_POOL; d_page->vaddr &= ~VADDR_FLAG_HUGE_POOL;
dma_free_coherent(pool->dev, pool->size, (void *)d_page->vaddr, dma); if (pool->type & IS_HUGE)
attrs = DMA_ATTR_NO_WARN;
dma_free_attrs(pool->dev, pool->size, (void *)d_page->vaddr, dma, attrs);
kfree(d_page); kfree(d_page);
d_page = NULL; d_page = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment