Commit 0b062865 authored by Christian König's avatar Christian König

drm/ttm: fix broken merge between drm-next and drm-misc-next

drm-next reverted the changes to ttm_tt_create() to do the
NULL check inside the function, but drm-misc-next adds new
users of this approach.

Re-apply the NULL check change inside the function to fix this.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/386628/
parent cdd296cd
...@@ -1180,7 +1180,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, ...@@ -1180,7 +1180,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
/* /*
* We might need to add a TTM. * We might need to add a TTM.
*/ */
if (bo->mem.mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) { if (bo->mem.mem_type == TTM_PL_SYSTEM) {
ret = ttm_tt_create(bo, true); ret = ttm_tt_create(bo, true);
if (ret) if (ret)
return ret; return ret;
......
...@@ -50,6 +50,9 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc) ...@@ -50,6 +50,9 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)
dma_resv_assert_held(bo->base.resv); dma_resv_assert_held(bo->base.resv);
if (bo->ttm)
return 0;
if (bdev->need_dma32) if (bdev->need_dma32)
page_flags |= TTM_PAGE_FLAG_DMA32; page_flags |= TTM_PAGE_FLAG_DMA32;
...@@ -67,7 +70,6 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc) ...@@ -67,7 +70,6 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)
page_flags |= TTM_PAGE_FLAG_SG; page_flags |= TTM_PAGE_FLAG_SG;
break; break;
default: default:
bo->ttm = NULL;
pr_err("Illegal buffer object type\n"); pr_err("Illegal buffer object type\n");
return -EINVAL; return -EINVAL;
} }
......
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