aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/pm/amdgpu_pm.c
diff options
context:
space:
mode:
authorFlora Cui <[email protected]>2022-01-13 06:55:24 +0000
committerAlex Deucher <[email protected]>2022-01-14 22:52:47 +0000
commit1613f346f86b25121aceb941d03ca927e57af20c (patch)
tree482dc2939cafdd2603cc5ebc25d078457d233884 /drivers/gpu/drm/amd/pm/amdgpu_pm.c
parentdrm/amdgpu: fix compile warning for ras_block_match_default (diff)
downloadkernel-1613f346f86b25121aceb941d03ca927e57af20c.tar.gz
kernel-1613f346f86b25121aceb941d03ca927e57af20c.zip
drm/amd/pm: fix null ptr access
check null ptr first before access its element v2: check adev->pm.dpm_enabled early in amdgpu_debugfs_pm_init() Signed-off-by: Flora Cui <[email protected]> Reviewed-by: Evan Quan <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/pm/amdgpu_pm.c')
-rw-r--r--drivers/gpu/drm/amd/pm/amdgpu_pm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index 1b03ad7a21ad..49a9c6375343 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -3583,6 +3583,9 @@ void amdgpu_debugfs_pm_init(struct amdgpu_device *adev)
struct drm_minor *minor = adev_to_drm(adev)->primary;
struct dentry *root = minor->debugfs_root;
+ if (!adev->pm.dpm_enabled)
+ return;
+
debugfs_create_file("amdgpu_pm_info", 0444, root, adev,
&amdgpu_debugfs_pm_info_fops);