[PATCH] drm/amd/pm: Fix a memory leak on an error path

Alex Deucher alexdeucher at gmail.com
Tue Oct 10 17:59:17 UTC 2023


Applied.  Thanks!

Alex

On Tue, Oct 10, 2023 at 2:32 AM Wang, Yang(Kevin)
<KevinYang.Wang at amd.com> wrote:
>
> [AMD Official Use Only - General]
>
> Reviewed-by: Yang Wang <kevinyang.wang at amd.com>
>
> Best Regards,
> Kevin
>
> -----Original Message-----
> From: Kunwu.Chan <chentao at kylinos.cn>
> Sent: Tuesday, October 10, 2023 2:11 PM
> To: Wang, Yang(Kevin) <KevinYang.Wang at amd.com>
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Kamal, Asad <Asad.Kamal at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>; Zhang, Hawking <Hawking.Zhang at amd.com>; Ma, Le <Le.Ma at amd.com>; Lazar, Lijo <Lijo.Lazar at amd.com>; Pan, Xinhui <Xinhui.Pan at amd.com>; airlied at gmail.com; amd-gfx at lists.freedesktop.org; chentao at kylinos.cn; dan.carpenter at linaro.org; daniel at ffwll.ch; dri-devel at lists.freedesktop.org; evan.quan at amd.com; kunwu.chan at hotmail.com; linux-kernel at vger.kernel.org
> Subject: [PATCH] drm/amd/pm: Fix a memory leak on an error path
>
> Add missing free on an error path.
>
> Fixes: 511a95552ec8 ("drm/amd/pm: Add SMU 13.0.6 support")
> Signed-off-by: Kunwu.Chan <chentao at kylinos.cn>
> ---
>  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
>


More information about the amd-gfx mailing list