Commit 08572451 authored by Dinghao Liu's avatar Dinghao Liu Committed by Alex Deucher

drm/amd/display: Fix memleak in amdgpu_dm_mode_config_init

When amdgpu_display_modeset_create_props() fails, state and
state->context should be freed to prevent memleak. It's the
same when amdgpu_dm_audio_init() fails.
Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent faeefe4e
...@@ -2905,12 +2905,18 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) ...@@ -2905,12 +2905,18 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev)
&dm_atomic_state_funcs); &dm_atomic_state_funcs);
r = amdgpu_display_modeset_create_props(adev); r = amdgpu_display_modeset_create_props(adev);
if (r) if (r) {
dc_release_state(state->context);
kfree(state);
return r; return r;
}
r = amdgpu_dm_audio_init(adev); r = amdgpu_dm_audio_init(adev);
if (r) if (r) {
dc_release_state(state->context);
kfree(state);
return r; return r;
}
return 0; return 0;
} }
......
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