[PATCH 6.0 738/862] drm/amd: fix potential memory leak

From: Greg Kroah-Hartman
Date: Wed Oct 19 2022 - 06:56:48 EST


From: Bernard Zhao <bernard@xxxxxxxx>

[ Upstream commit 6160216fd2c97107e8a9ab39863b056d677fcd85 ]

This patch fix potential memory leak (clk_src) when function run
into last return NULL.

s/free/kfree/ - Alex

Signed-off-by: Bernard Zhao <bernard@xxxxxxxx>
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c
index 3cd7c91655c5..6d721fadcbee 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c
@@ -1720,6 +1720,7 @@ static struct clock_source *dcn30_clock_source_create(
}

BREAK_TO_DEBUGGER();
+ kfree(clk_src);
return NULL;
}

--
2.35.1