[PATCH] drm/amdgpu: Skip put_reset_domain if it doesnt exist

Liu, Shaoyun Shaoyun.Liu at amd.com
Wed Sep 28 22:02:13 UTC 2022


Looks OK to me.
Reviewed by : shaoyun.liu <shaoyun.liu at amd.com>


________________________________
From: Chander, Vignesh <Vignesh.Chander at amd.com>
Sent: September 28, 2022 3:03 PM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Liu, Shaoyun <Shaoyun.Liu at amd.com>; Chander, Vignesh <Vignesh.Chander at amd.com>
Subject: [PATCH] drm/amdgpu: Skip put_reset_domain if it doesnt exist

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 at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h
index dc43fcb93eac..f5318fedf2f0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h
@@ -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,
--
2.25.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20220928/8c5d191d/attachment.htm>


More information about the amd-gfx mailing list