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: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/386628/
        /*
         * 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);
                if (ret)
                        return ret;
 
 
        dma_resv_assert_held(bo->base.resv);
 
+       if (bo->ttm)
+               return 0;
+
        if (bdev->need_dma32)
                page_flags |= TTM_PAGE_FLAG_DMA32;
 
                page_flags |= TTM_PAGE_FLAG_SG;
                break;
        default:
-               bo->ttm = NULL;
                pr_err("Illegal buffer object type\n");
                return -EINVAL;
        }