summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorLikun Gao <Likun.Gao@amd.com>2019-12-25 17:42:35 +0800
committerAlex Deucher <alexander.deucher@amd.com>2020-01-07 11:57:28 -0500
commite78adc5a1d34eda80f157e9af477284989a62bdb (patch)
tree1d6aae6e674846a1398c08cf3b6f1be32c128ec2 /drivers/gpu/drm/amd
parentd2f925ff9a239a49339d785f721c8cd89b743539 (diff)
drm/amdgpu/powerplay: fix NULL pointer issue when SMU disabled
Fix smu related NULL pointer issue which occurs when SMU is disabled. Signed-off-by: Likun Gao <Likun.Gao@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')
-rw-r--r--drivers/gpu/drm/amd/powerplay/amdgpu_smu.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index d04c0ae3cfaa..e51cf5a151e8 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1904,8 +1904,14 @@ int smu_write_watermarks_table(struct smu_context *smu)
int smu_set_watermarks_for_clock_ranges(struct smu_context *smu,
struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges)
{
- struct smu_table *watermarks = &smu->smu_table.tables[SMU_TABLE_WATERMARKS];
- void *table = watermarks->cpu_addr;
+ struct smu_table *watermarks;
+ void *table;
+
+ if (!smu->smu_table.tables)
+ return 0;
+
+ watermarks = &smu->smu_table.tables[SMU_TABLE_WATERMARKS];
+ table = watermarks->cpu_addr;
mutex_lock(&smu->mutex);
@@ -2397,7 +2403,7 @@ bool smu_baco_is_support(struct smu_context *smu)
mutex_lock(&smu->mutex);
- if (smu->ppt_funcs->baco_is_support)
+ if (smu->ppt_funcs && smu->ppt_funcs->baco_is_support)
ret = smu->ppt_funcs->baco_is_support(smu);
mutex_unlock(&smu->mutex);