diff mbox series

drm/amd/display: Fix memory leak in dcn21_clock_source_create

Message ID 20220421090313.24864-1-linmq006@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/amd/display: Fix memory leak in dcn21_clock_source_create | expand

Commit Message

Miaoqian Lin April 21, 2022, 9:03 a.m. UTC
When dcn20_clk_src_construct() fails, we need to release clk_src.

Fixes: 6f4e6361c3ff ("drm/amd/display: Add Renoir resource (v2)")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Alex Deucher April 21, 2022, 2:22 p.m. UTC | #1
Applied.  Thanks!

Alex

On Thu, Apr 21, 2022 at 5:03 AM Miaoqian Lin <linmq006@gmail.com> wrote:
>
> When dcn20_clk_src_construct() fails, we need to release clk_src.
>
> Fixes: 6f4e6361c3ff ("drm/amd/display: Add Renoir resource (v2)")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
> index 3fe4bfbb98a0..faab59508d82 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
> @@ -997,6 +997,7 @@ static struct clock_source *dcn21_clock_source_create(
>                 return &clk_src->base;
>         }
>
> +       kfree(clk_src);
>         BREAK_TO_DEBUGGER();
>         return NULL;
>  }
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
index 3fe4bfbb98a0..faab59508d82 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
@@ -997,6 +997,7 @@  static struct clock_source *dcn21_clock_source_create(
 		return &clk_src->base;
 	}
 
+	kfree(clk_src);
 	BREAK_TO_DEBUGGER();
 	return NULL;
 }