]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/pm: fix a potential gpu_metrics_table memory leak
authorLang Yu <lang.yu@amd.com>
Tue, 14 Dec 2021 07:25:54 +0000 (15:25 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 14 Dec 2021 22:59:19 +0000 (17:59 -0500)
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: 6564e28fb2f2 ("drm/amd/powerplay: add Renoir support for gpu metrics export")
Signed-off-by: Lang Yu <lang.yu@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c

index d60b8c5e871575b2ea617e1c7c471f12b9020f38..43028f2cd28b5e57cda8d2a78294022c025b5318 100644 (file)
@@ -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;
 }