Commit f957138c authored by Hawking Zhang's avatar Hawking Zhang Committed by Alex Deucher
Browse files

drm/amdgpu: Only create err_count sysfs when hw_op is supported



Some IP blocks only support partial ras feature and don't
have ras counter and/or ras error status register at all.
Driver should not create err_count sysfs node for those
IP blocks.

Signed-off-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: default avatarTao Zhou <tao.zhou1@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e0138644
Loading
Loading
Loading
Loading
+18 −13
Original line number Diff line number Diff line
@@ -2777,13 +2777,16 @@ int amdgpu_ras_block_late_init(struct amdgpu_device *adev,
			goto cleanup;
	}

	if (ras_obj->hw_ops &&
	    (ras_obj->hw_ops->query_ras_error_count ||
	     ras_obj->hw_ops->query_ras_error_status)) {
		r = amdgpu_ras_sysfs_create(adev, ras_block);
		if (r)
			goto interrupt;

		/* Those are the cached values at init.
		 */
	query_info = kzalloc(sizeof(struct ras_query_if), GFP_KERNEL);
		query_info = kzalloc(sizeof(*query_info), GFP_KERNEL);
		if (!query_info)
			return -ENOMEM;
		memcpy(&query_info->head, ras_block, sizeof(struct ras_common_if));
@@ -2794,6 +2797,8 @@ int amdgpu_ras_block_late_init(struct amdgpu_device *adev,
		}

		kfree(query_info);
	}

	return 0;

interrupt: