author: Christian König <christian.koenig@amd.com> 2023-07-07 11:07:27 -0400
committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2023-07-19 16:37:01 +0200
commit: fbec04aa5cb8fb64e44c59275fd4431abeaba06f
parent: 2eb044def66c10dc9cb50b06b81fc839e867d3b1
Commit Summary:
Diffstat:
1 file changed, 4 insertions, 1 deletion
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index a70103ac0026..46557bbbc18a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -1266,8 +1266,12 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
struct amdgpu_mem_stats *stats)
{
- unsigned int domain;
uint64_t size = amdgpu_bo_size(bo);
+ unsigned int domain;
+
+ /* Abort if the BO doesn't currently have a backing store */
+ if (!bo->tbo.resource)
+ return;
domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type);
switch (domain) {