Commit 674704a5 authored by Hersen Wu's avatar Hersen Wu Committed by Alex Deucher

drm/amd/display: Release clck_src memory if clk_src_construct fails

[Why]
Coverity reports RESOURCE_LEAK for some implemenations
of clock_source_create. Do not release memory of clk_src
if contructor fails.

[How]
Free clk_src if contructor fails.
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Acked-by: default avatarTom Chung <chiahsuan.chung@amd.com>
Signed-off-by: default avatarHersen Wu <hersenxs.wu@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ca46da75
...@@ -1538,6 +1538,7 @@ struct resource_pool *dce83_create_resource_pool( ...@@ -1538,6 +1538,7 @@ struct resource_pool *dce83_create_resource_pool(
if (dce83_construct(num_virtual_links, dc, pool)) if (dce83_construct(num_virtual_links, dc, pool))
return &pool->base; return &pool->base;
kfree(pool);
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
return NULL; return NULL;
} }
...@@ -1864,6 +1864,7 @@ static struct clock_source *dcn30_clock_source_create( ...@@ -1864,6 +1864,7 @@ static struct clock_source *dcn30_clock_source_create(
return &clk_src->base; return &clk_src->base;
} }
kfree(clk_src);
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
return NULL; return NULL;
} }
......
...@@ -1660,8 +1660,8 @@ static struct clock_source *dcn31_clock_source_create( ...@@ -1660,8 +1660,8 @@ static struct clock_source *dcn31_clock_source_create(
return &clk_src->base; return &clk_src->base;
} }
BREAK_TO_DEBUGGER();
kfree(clk_src); kfree(clk_src);
BREAK_TO_DEBUGGER();
return NULL; return NULL;
} }
...@@ -1821,8 +1821,8 @@ static struct clock_source *dcn30_clock_source_create( ...@@ -1821,8 +1821,8 @@ static struct clock_source *dcn30_clock_source_create(
return &clk_src->base; return &clk_src->base;
} }
BREAK_TO_DEBUGGER();
kfree(clk_src); kfree(clk_src);
BREAK_TO_DEBUGGER();
return NULL; return NULL;
} }
......
...@@ -1716,6 +1716,7 @@ static struct clock_source *dcn35_clock_source_create( ...@@ -1716,6 +1716,7 @@ static struct clock_source *dcn35_clock_source_create(
return &clk_src->base; return &clk_src->base;
} }
kfree(clk_src);
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
return NULL; return NULL;
} }
......
...@@ -1696,6 +1696,7 @@ static struct clock_source *dcn35_clock_source_create( ...@@ -1696,6 +1696,7 @@ static struct clock_source *dcn35_clock_source_create(
return &clk_src->base; return &clk_src->base;
} }
kfree(clk_src);
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