drm/amdgpu: free the metadata buffer for sg type BOs as well

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>
This commit is contained in:
Shiwu Zhang 2021-05-26 11:42:14 +08:00 committed by Alex Deucher
parent eba9852372
commit 3c609c8b1f

View 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);
}