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

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
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -3128,9 +3128,12 @@ void amdgpu_dm_update_connector_after_detect(
						    aconnector->edid);
		}

		aconnector->timing_requested = kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL);
		if (!aconnector->timing_requested) {
			aconnector->timing_requested =
				kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL);
			if (!aconnector->timing_requested)
			dm_error("%s: failed to create aconnector->requested_timing\n", __func__);
				dm_error("failed to create aconnector->requested_timing\n");
		}

		drm_connector_update_edid_property(connector, aconnector->edid);
		amdgpu_dm_update_freesync_caps(connector, aconnector->edid);