OSDN Git Service

drm/amdgpu: Skip put_reset_domain if it doesn't exist
authorVignesh Chander <Vignesh.Chander@amd.com>
Wed, 28 Sep 2022 18:59:45 +0000 (14:59 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 29 Sep 2022 13:43:52 +0000 (09:43 -0400)
For xgmi sriov, the reset is handled by host driver and hive->reset_domain
is not initialized so need to check if it exists before doing a put.

Signed-off-by: Vignesh Chander <Vignesh.Chander@amd.com>
Reviewed-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h

index dc43fcb..f5318fe 100644 (file)
@@ -113,7 +113,8 @@ static inline bool amdgpu_reset_get_reset_domain(struct amdgpu_reset_domain *dom
 
 static inline void amdgpu_reset_put_reset_domain(struct amdgpu_reset_domain *domain)
 {
-       kref_put(&domain->refcount, amdgpu_reset_destroy_reset_domain);
+       if (domain)
+               kref_put(&domain->refcount, amdgpu_reset_destroy_reset_domain);
 }
 
 static inline bool amdgpu_reset_domain_schedule(struct amdgpu_reset_domain *domain,