[PATCH] drm/amd/pm: fix a potential gpu_metrics_table memory leak

Lazar, Lijo lijo.lazar at amd.com
Tue Dec 14 08:41:15 UTC 2021



On 12/14/2021 1:36 PM, Lang Yu wrote:
> Memory is allocated for gpu_metrics_table in renoir_init_smc_tables(),
> but not freed in int smu_v12_0_fini_smc_tables(). Free it!
> 
> Fixes: 95868b85764a ("drm/amd/powerplay: add Renoir support for gpu metrics export")
> 
> Signed-off-by: Lang Yu <lang.yu at amd.com>

Reviewed-by: Lijo Lazar <lijo.lazar at amd.com>

Thanks,
Lijo

> ---
>   drivers/gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c
> index d60b8c5e8715..43028f2cd28b 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c
> @@ -191,6 +191,9 @@ int smu_v12_0_fini_smc_tables(struct smu_context *smu)
>   	kfree(smu_table->watermarks_table);
>   	smu_table->watermarks_table = NULL;
>   
> +	kfree(smu_table->gpu_metrics_table);
> +	smu_table->gpu_metrics_table = NULL;
> +
>   	return 0;
>   }
>   
> 


More information about the amd-gfx mailing list