[PATCH 25/45] drm/amd/display: Release state memory if amdgpu_dm_create_color_properties fail
Tom Chung
chiahsuan.chung at amd.com
Wed May 1 07:16:31 UTC 2024
From: Hersen Wu <hersenxs.wu at amd.com>
[Why]
Coverity reports RESOURCE_LEAK warning. State memory
is not released if dm_create_color_properties fail.
[How]
Call kfree(state) before return.
Reviewed-by: Alex Hung <alex.hung at amd.com>
Reviewed-by: Harry Wentland <harry.wentland at amd.com>
Acked-by: Tom Chung <chiahsuan.chung at amd.com>
Signed-off-by: Hersen Wu <hersenxs.wu at amd.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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 af35bb3c3b19..3abb2e6e7ebb 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4229,8 +4229,11 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev)
}
#ifdef AMD_PRIVATE_COLOR
- if (amdgpu_dm_create_color_properties(adev))
+ if (amdgpu_dm_create_color_properties(adev)) {
+ dc_state_release(state->context);
+ kfree(state);
return -ENOMEM;
+ }
#endif
r = amdgpu_dm_audio_init(adev);
--
2.34.1
More information about the amd-gfx
mailing list