Commit bb67bfd2 authored by Dor Askayo's avatar Dor Askayo Committed by Alex Deucher

drm/amd/display: do not allocate display_mode_lib unnecessarily

This allocation isn't required and can fail when resuming from suspend.

Bug: https://gitlab.freedesktop.org/drm/amd/issues/1009Signed-off-by: default avatarDor Askayo <dor.askayo@gmail.com>
Reviewed-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 77171ead
...@@ -2462,12 +2462,7 @@ void dc_set_power_state( ...@@ -2462,12 +2462,7 @@ void dc_set_power_state(
enum dc_acpi_cm_power_state power_state) enum dc_acpi_cm_power_state power_state)
{ {
struct kref refcount; struct kref refcount;
struct display_mode_lib *dml = kzalloc(sizeof(struct display_mode_lib), struct display_mode_lib *dml;
GFP_KERNEL);
ASSERT(dml);
if (!dml)
return;
switch (power_state) { switch (power_state) {
case DC_ACPI_CM_POWER_STATE_D0: case DC_ACPI_CM_POWER_STATE_D0:
...@@ -2490,6 +2485,12 @@ void dc_set_power_state( ...@@ -2490,6 +2485,12 @@ void dc_set_power_state(
* clean state, and dc hw programming optimizations will not * clean state, and dc hw programming optimizations will not
* cause any trouble. * cause any trouble.
*/ */
dml = kzalloc(sizeof(struct display_mode_lib),
GFP_KERNEL);
ASSERT(dml);
if (!dml)
return;
/* Preserve refcount */ /* Preserve refcount */
refcount = dc->current_state->refcount; refcount = dc->current_state->refcount;
...@@ -2503,10 +2504,10 @@ void dc_set_power_state( ...@@ -2503,10 +2504,10 @@ void dc_set_power_state(
dc->current_state->refcount = refcount; dc->current_state->refcount = refcount;
dc->current_state->bw_ctx.dml = *dml; dc->current_state->bw_ctx.dml = *dml;
kfree(dml);
break; break;
} }
kfree(dml);
} }
void dc_resume(struct dc *dc) void dc_resume(struct dc *dc)
......
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