Skip to content

Commit 025ce39

Browse files
Hersen Wualexdeucher
authored andcommitted
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: Qingqing Zhuo <Qingqing.Zhuo@amd.com> Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com> Signed-off-by: Hersen Wu <hersenxs.wu@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent da5e149 commit 025ce39

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3128,9 +3128,12 @@ void amdgpu_dm_update_connector_after_detect(
31283128
aconnector->edid);
31293129
}
31303130

3131-
aconnector->timing_requested = kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL);
3132-
if (!aconnector->timing_requested)
3133-
dm_error("%s: failed to create aconnector->requested_timing\n", __func__);
3131+
if (!aconnector->timing_requested) {
3132+
aconnector->timing_requested =
3133+
kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL);
3134+
if (!aconnector->timing_requested)
3135+
dm_error("failed to create aconnector->requested_timing\n");
3136+
}
31343137

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

0 commit comments

Comments
 (0)