[PATCH] drm/amdgpu/powerplay: fix NULL pointer issue when SMU disabled
Quan, Evan
Evan.Quan at amd.com
Thu Dec 26 07:33:45 UTC 2019
Reviewed-by: Evan Quan <evan.quan at amd.com>
> -----Original Message-----
> From: Gao, Likun <Likun.Gao at amd.com>
> Sent: Thursday, December 26, 2019 1:07 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Quan, Evan <Evan.Quan at amd.com>; Xu, Feifei <Feifei.Xu at amd.com>;
> Feng, Kenneth <Kenneth.Feng at amd.com>; Gao, Likun <Likun.Gao at amd.com>
> Subject: [PATCH] drm/amdgpu/powerplay: fix NULL pointer issue when SMU
> disabled
>
> From: Likun Gao <Likun.Gao at amd.com>
>
> Fix smu related NULL pointer issue which occurs when SMU is disabled.
>
> Signed-off-by: Likun Gao <Likun.Gao at amd.com>
> ---
> drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 12 +++++++++---
> 1 file 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 d07c4f2..3724085 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -1905,8 +1905,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);
>
> @@ -2398,7 +2404,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);
> --
> 2.7.4
More information about the amd-gfx
mailing list