mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 05:49:47 -04:00
drm/amd/display: Remove redundant NULL check before kfree() in mod_power_create()
kfree() safely handles NULL pointers, so there is no need to check for NULL before calling kfree(). Remove redundant NULL check. Found by Coccinelle ifnullfree script. Signed-off-by: Ziran Zhang <zhangcoder@yeah.net> Reviewed-by: George Zhang <george.zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
81b39f43e7
commit
9835f031f0
@@ -270,13 +270,11 @@ struct mod_power *mod_power_create(struct dc *dc,
|
||||
fail_bad_brightness_range:
|
||||
fail_alloc_backlight_array:
|
||||
for (inst = 0; inst < edp_num; inst++)
|
||||
if (core_power->bl_prop[inst].backlight_lut)
|
||||
kfree(core_power->bl_prop[inst].backlight_lut);
|
||||
kfree(core_power->bl_prop[inst].backlight_lut);
|
||||
fail_construct:
|
||||
for (i = 0; i < MOD_POWER_MAX_CONCURRENT_STREAMS; i++) {
|
||||
if (core_power->map[i].psr_context)
|
||||
kfree(core_power->map[i].psr_context);
|
||||
}
|
||||
for (i = 0; i < MOD_POWER_MAX_CONCURRENT_STREAMS; i++)
|
||||
kfree(core_power->map[i].psr_context);
|
||||
|
||||
kfree(core_power->map);
|
||||
|
||||
fail_alloc_map:
|
||||
@@ -295,8 +293,7 @@ void mod_power_destroy(struct mod_power *mod_power)
|
||||
MOD_POWER_TO_CORE(mod_power);
|
||||
|
||||
for (i = 0; i < MOD_POWER_MAX_CONCURRENT_STREAMS; i++)
|
||||
if (core_power->map[i].psr_context)
|
||||
kfree(core_power->map[i].psr_context);
|
||||
kfree(core_power->map[i].psr_context);
|
||||
|
||||
for (i = 0; i < core_power->num_entities; i++)
|
||||
if (core_power->map[i].stream)
|
||||
@@ -305,8 +302,7 @@ void mod_power_destroy(struct mod_power *mod_power)
|
||||
kfree(core_power->map);
|
||||
|
||||
for (i = 0; i < MAX_NUM_EDP; i++)
|
||||
if (core_power->bl_prop[i].backlight_lut)
|
||||
kfree(core_power->bl_prop[i].backlight_lut);
|
||||
kfree(core_power->bl_prop[i].backlight_lut);
|
||||
|
||||
kfree(core_power);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user