Skip to content

Commit ca0b954

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/amdgpu: make sure that BOs have a backing store
It's perfectly possible that the BO is about to be destroyed and doesn't have a backing store associated with it. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Guchun Chen <guchun.chen@amd.com> Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent e2ad8e2 commit ca0b954

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,8 +1282,12 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
12821282
void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
12831283
struct amdgpu_mem_stats *stats)
12841284
{
1285-
unsigned int domain;
12861285
uint64_t size = amdgpu_bo_size(bo);
1286+
unsigned int domain;
1287+
1288+
/* Abort if the BO doesn't currently have a backing store */
1289+
if (!bo->tbo.resource)
1290+
return;
12871291

12881292
domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type);
12891293
switch (domain) {

0 commit comments

Comments
 (0)