drm/amdgpu: fix error handling in amdgpu_bo_list_create
authorChristian König <christian.koenig@amd.com>
Wed, 18 Sep 2019 17:42:14 +0000 (19:42 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Oct 2019 19:50:07 +0000 (15:50 -0400)
We need to drop normal and userptr BOs separately.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c

index 61e38e43ad1d524f811ad2d7dfaf155a16d97f89..85b0515c0fdcf7c0e69558988fdbb534c9efa302 100644 (file)
@@ -140,7 +140,12 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
        return 0;
 
 error_free:
-       while (i--) {
+       for (i = 0; i < last_entry; ++i) {
+               struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
+
+               amdgpu_bo_unref(&bo);
+       }
+       for (i = first_userptr; i < num_entries; ++i) {
                struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
 
                amdgpu_bo_unref(&bo);