drm/amdgpu: Fix hive reference count leak
authorVignesh Chander <Vignesh.Chander@amd.com>
Fri, 9 Sep 2022 13:28:46 +0000 (09:28 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 13 Sep 2022 18:32:57 +0000 (14:32 -0400)
both get_xgmi_hive and put_xgmi_hive can be skipped since the
reset domain is not necessary for VF

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_device.c

index e218043..943c9e7 100644 (file)
@@ -2451,9 +2451,9 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
         */
        if (adev->gmc.xgmi.num_physical_nodes > 1) {
                if (amdgpu_xgmi_add_device(adev) == 0) {
-                       struct amdgpu_hive_info *hive = amdgpu_get_xgmi_hive(adev);
-
                        if (!amdgpu_sriov_vf(adev)) {
+                               struct amdgpu_hive_info *hive = amdgpu_get_xgmi_hive(adev);
+
                                if (!hive->reset_domain ||
                                    !amdgpu_reset_get_reset_domain(hive->reset_domain)) {
                                        r = -ENOENT;