aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDinghao Liu <[email protected]>2020-08-26 13:24:58 +0000
committerAlex Deucher <[email protected]>2020-08-26 20:40:19 +0000
commit08572451b4b1783fdff787b0188c4d50fdf96b81 (patch)
treec8abf7a3a33998f4003238ddb125f9aa8d7ca684
parentdrm/amdgpu: disable runtime pm for navy_flounder (diff)
downloadkernel-08572451b4b1783fdff787b0188c4d50fdf96b81.tar.gz
kernel-08572451b4b1783fdff787b0188c4d50fdf96b81.zip
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: Dinghao Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 785f21ea35df..e2e7138c4e3f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2905,12 +2905,18 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev)
&dm_atomic_state_funcs);
r = amdgpu_display_modeset_create_props(adev);
- if (r)
+ if (r) {
+ dc_release_state(state->context);
+ kfree(state);
return r;
+ }
r = amdgpu_dm_audio_init(adev);
- if (r)
+ if (r) {
+ dc_release_state(state->context);
+ kfree(state);
return r;
+ }
return 0;
}