Commit 025ce392 authored by Hersen Wu's avatar Hersen Wu Committed by Alex Deucher

drm/amd/display: fix memleak in aconnector->timing_requested

[Why]
when amdgpu_dm_update_connector_after_detect is called
two times successively with valid sink, memory allocated of
aconnector->timing_requested for the first call is not free.
this causes memeleak.

[How]
allocate memory only when aconnector->timing_requested
is null.
Reviewed-by: default avatarQingqing Zhuo <Qingqing.Zhuo@amd.com>
Acked-by: default avatarQingqing Zhuo <qingqing.zhuo@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 da5e1490
...@@ -3128,9 +3128,12 @@ void amdgpu_dm_update_connector_after_detect( ...@@ -3128,9 +3128,12 @@ void amdgpu_dm_update_connector_after_detect(
aconnector->edid); aconnector->edid);
} }
aconnector->timing_requested = kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL); if (!aconnector->timing_requested) {
if (!aconnector->timing_requested) aconnector->timing_requested =
dm_error("%s: failed to create aconnector->requested_timing\n", __func__); kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL);
if (!aconnector->timing_requested)
dm_error("failed to create aconnector->requested_timing\n");
}
drm_connector_update_edid_property(connector, aconnector->edid); drm_connector_update_edid_property(connector, aconnector->edid);
amdgpu_dm_update_freesync_caps(connector, aconnector->edid); amdgpu_dm_update_freesync_caps(connector, aconnector->edid);
......
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