Commit 447395e1 authored by Deepak R Varma's avatar Deepak R Varma Committed by Alex Deucher

drm/amd/display: No need for Null pointer check before kfree

kfree() & vfree() internally performs NULL check on the pointer handed
to it and take no action if it indeed is NULL. Hence there is no need
for a pre-check of the memory pointer before handing it to
kfree()/vfree().

Issue reported by ifnullfree.cocci Coccinelle semantic patch script.
Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarDeepak R Varma <drv@mailo.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 45bf7971
...@@ -577,8 +577,7 @@ void dcn3_clk_mgr_construct( ...@@ -577,8 +577,7 @@ void dcn3_clk_mgr_construct(
void dcn3_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr) void dcn3_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr)
{ {
if (clk_mgr->base.bw_params) kfree(clk_mgr->base.bw_params);
kfree(clk_mgr->base.bw_params);
if (clk_mgr->wm_range_table) if (clk_mgr->wm_range_table)
dm_helpers_free_gpu_mem(clk_mgr->base.ctx, DC_MEM_ALLOC_TYPE_GART, dm_helpers_free_gpu_mem(clk_mgr->base.ctx, DC_MEM_ALLOC_TYPE_GART,
......
...@@ -783,8 +783,7 @@ void dcn32_clk_mgr_construct( ...@@ -783,8 +783,7 @@ void dcn32_clk_mgr_construct(
void dcn32_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr) void dcn32_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr)
{ {
if (clk_mgr->base.bw_params) kfree(clk_mgr->base.bw_params);
kfree(clk_mgr->base.bw_params);
if (clk_mgr->wm_range_table) if (clk_mgr->wm_range_table)
dm_helpers_free_gpu_mem(clk_mgr->base.ctx, DC_MEM_ALLOC_TYPE_GART, dm_helpers_free_gpu_mem(clk_mgr->base.ctx, DC_MEM_ALLOC_TYPE_GART,
......
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