drm/amdgpu: free the metadata buffer for sg type BOs as well
authorShiwu Zhang <shiwu.zhang@amd.com>
Wed, 26 May 2021 03:42:14 +0000 (11:42 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 2 Jun 2021 02:36:23 +0000 (22:36 -0400)
Since both sg and device type BOs have metadata buffer, free
the buffer in both cases when to destroy BOs

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
Acked-by: Nirmoy Das <Nirmoy.das@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

index 9fcb3bc59558c8ac90c6ab7fa07e0af1d7e7aeb6..b382e9453a66546d86e519da002ba0d7c4e6315e 100644 (file)
@@ -71,7 +71,7 @@ static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo)
        }
        amdgpu_bo_unref(&bo->parent);
 
-       if (bo->tbo.type == ttm_bo_type_device) {
+       if (bo->tbo.type != ttm_bo_type_kernel) {
                ubo = to_amdgpu_bo_user(bo);
                kfree(ubo->metadata);
        }