summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
diff options
context:
space:
mode:
authorFlora Cui <flora.cui@amd.com>2022-01-13 09:55:24 +0300
committerAlex Deucher <alexander.deucher@amd.com>2022-01-15 01:52:47 +0300
commit1613f346f86b25121aceb941d03ca927e57af20c (patch)
tree482dc2939cafdd2603cc5ebc25d078457d233884 /drivers/gpu/drm/amd/pm/amdgpu_dpm.c
parente3d833f41c46b8c59c4af53897a6619bf667ebe5 (diff)
downloadlinux-1613f346f86b25121aceb941d03ca927e57af20c.tar.xz
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 <flora.cui@amd.com> Reviewed-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/pm/amdgpu_dpm.c')
-rw-r--r--drivers/gpu/drm/amd/pm/amdgpu_dpm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
index f0daa66f5b3d..5fc33893a68c 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
@@ -463,7 +463,7 @@ int amdgpu_pm_load_smu_firmware(struct amdgpu_device *adev, uint32_t *smu_versio
const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
int r = 0;
- if (!pp_funcs->load_firmware)
+ if (!pp_funcs || !pp_funcs->load_firmware)
return 0;
mutex_lock(&adev->pm.mutex);