drm/amdgpu: add err check for pin userptr
authorChunming Zhou <David1.Zhou@amd.com>
Thu, 26 Nov 2015 08:33:58 +0000 (16:33 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 4 Dec 2015 16:26:51 +0000 (11:26 -0500)
Missing error check if the operation failed.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index d4bac5f49939e1a780e5897754779fde9d1733d6..8051cb9b8c1edba63192e922a3fdf66b26cb0d5d 100644 (file)
@@ -587,9 +587,13 @@ static int amdgpu_ttm_backend_bind(struct ttm_tt *ttm,
        uint32_t flags = amdgpu_ttm_tt_pte_flags(gtt->adev, ttm, bo_mem);
        int r;
 
-       if (gtt->userptr)
-               amdgpu_ttm_tt_pin_userptr(ttm);
-
+       if (gtt->userptr) {
+               r = amdgpu_ttm_tt_pin_userptr(ttm);
+               if (r) {
+                       DRM_ERROR("failed to pin userptr\n");
+                       return r;
+               }
+       }
        gtt->offset = (unsigned long)(bo_mem->start << PAGE_SHIFT);
        if (!ttm->num_pages) {
                WARN(1, "nothing to bind %lu pages for mreg %p back %p!\n",