drm/qxl: handle NULL bo->resource in move callback
[linux-2.6-microblaze.git] / drivers / gpu / drm / qxl / qxl_ttm.c
index a92a5b0..1a82629 100644 (file)
@@ -143,6 +143,17 @@ static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,
        struct ttm_resource *old_mem = bo->resource;
        int ret;
 
+       if (!old_mem) {
+               if (new_mem->mem_type != TTM_PL_SYSTEM) {
+                       hop->mem_type = TTM_PL_SYSTEM;
+                       hop->flags = TTM_PL_FLAG_TEMPORARY;
+                       return -EMULTIHOP;
+               }
+
+               ttm_bo_move_null(bo, new_mem);
+               return 0;
+       }
+
        qxl_bo_move_notify(bo, new_mem);
 
        ret = ttm_bo_wait_ctx(bo, ctx);