Fixes: 511a95552ec8 ("drm/amd/pm: Add SMU 13.0.6 support") Please add above information into your patch commit message. Reviewed-by: Yang Wang <kevinyang.wang@xxxxxxx> Best Regards, Kevin -----Original Message----- From: Kunwu.Chan <chentao@xxxxxxxxxx> Sent: Tuesday, October 10, 2023 10:19 AM To: evan.quan@xxxxxxx; Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Koenig, Christian <Christian.Koenig@xxxxxxx>; Pan, Xinhui <Xinhui.Pan@xxxxxxx>; airlied@xxxxxxxxx; daniel@xxxxxxxx; Lazar, Lijo <Lijo.Lazar@xxxxxxx>; Kamal, Asad <Asad.Kamal@xxxxxxx>; Zhang, Hawking <Hawking.Zhang@xxxxxxx>; Wang, Yang(Kevin) <KevinYang.Wang@xxxxxxx>; Ma, Le <Le.Ma@xxxxxxx>; dan.carpenter@xxxxxxxxxx Cc: amd-gfx@xxxxxxxxxxxxxxxxxxxxx; dri-devel@xxxxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; kunwu.chan@xxxxxxxxxxx; Kunwu.Chan <chentao@xxxxxxxxxx> Subject: [PATCH] drm/amd/pm: Fix a memory leak on an error path Add missing free on an error path. Signed-off-by: Kunwu.Chan <chentao@xxxxxxxxxx> --- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c index ce971a93d28b..c26e12ff532c 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c @@ -1981,8 +1981,10 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table metrics = kzalloc(sizeof(MetricsTable_t), GFP_KERNEL); ret = smu_v13_0_6_get_metrics_table(smu, metrics, true); - if (ret) + if (ret) { + kfree(metrics); return ret; + } smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 3); -- 2.25.1