Commit 60e1b411 authored by Navid Emamdoost's avatar Navid Emamdoost Committed by Greg Kroah-Hartman

drm/amd/display: prevent memory leak

[ Upstream commit 104c3071 ]

In dcn*_create_resource_pool the allocated memory should be released if
construct pool fails.
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarNavid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent e0cf3ebf
...@@ -1001,6 +1001,7 @@ struct resource_pool *dce100_create_resource_pool( ...@@ -1001,6 +1001,7 @@ struct resource_pool *dce100_create_resource_pool(
if (construct(num_virtual_links, dc, pool)) if (construct(num_virtual_links, dc, pool))
return &pool->base; return &pool->base;
kfree(pool);
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
return NULL; return NULL;
} }
......
...@@ -1344,6 +1344,7 @@ struct resource_pool *dce110_create_resource_pool( ...@@ -1344,6 +1344,7 @@ struct resource_pool *dce110_create_resource_pool(
if (construct(num_virtual_links, dc, pool, asic_id)) if (construct(num_virtual_links, dc, pool, asic_id))
return &pool->base; return &pool->base;
kfree(pool);
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
return NULL; return NULL;
} }
...@@ -1287,6 +1287,7 @@ struct resource_pool *dce112_create_resource_pool( ...@@ -1287,6 +1287,7 @@ struct resource_pool *dce112_create_resource_pool(
if (construct(num_virtual_links, dc, pool)) if (construct(num_virtual_links, dc, pool))
return &pool->base; return &pool->base;
kfree(pool);
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
return NULL; return NULL;
} }
...@@ -1076,6 +1076,7 @@ struct resource_pool *dce120_create_resource_pool( ...@@ -1076,6 +1076,7 @@ struct resource_pool *dce120_create_resource_pool(
if (construct(num_virtual_links, dc, pool)) if (construct(num_virtual_links, dc, pool))
return &pool->base; return &pool->base;
kfree(pool);
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
return NULL; return NULL;
} }
...@@ -1361,6 +1361,7 @@ struct resource_pool *dcn10_create_resource_pool( ...@@ -1361,6 +1361,7 @@ struct resource_pool *dcn10_create_resource_pool(
if (construct(num_virtual_links, dc, pool)) if (construct(num_virtual_links, dc, pool))
return &pool->base; return &pool->base;
kfree(pool);
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
return NULL; return NULL;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment