Unverified Commit f9f2b4a0 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!7396 drm/amdgpu: Fix cat debugfs amdgpu_regs_didt causes kernel null pointer

parents 9dccc6d1 e7adfbdc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -459,6 +459,9 @@ static ssize_t amdgpu_debugfs_regs_didt_read(struct file *f, char __user *buf,
	if (size & 0x3 || *pos & 0x3)
		return -EINVAL;

	if (!adev->didt_rreg)
		return -EOPNOTSUPP;

	r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
	if (r < 0) {
		pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
@@ -518,6 +521,9 @@ static ssize_t amdgpu_debugfs_regs_didt_write(struct file *f, const char __user
	if (size & 0x3 || *pos & 0x3)
		return -EINVAL;

	if (!adev->didt_wreg)
		return -EOPNOTSUPP;

	r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
	if (r < 0) {
		pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);