[PATCH AUTOSEL 6.0 11/44] drm/amd: fix potential memory leak

From: Sasha Levin
Date: Sun Oct 09 2022 - 20:13:53 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 44ac1c2aabf5..b96e8089aaa3 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c
@@ -1719,6 +1719,7 @@ static struct clock_source *dcn30_clock_source_create(
}

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

--
2.35.1