Skip to content

Commit

Permalink
drm/amd/display: Release state memory if amdgpu_dm_create_color_prope…
Browse files Browse the repository at this point in the history
…rties fail

[ Upstream commit 52cbcf9 ]

[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 <[email protected]>
Reviewed-by: Harry Wentland <[email protected]>
Acked-by: Tom Chung <[email protected]>
Signed-off-by: Hersen Wu <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Hersen Wu authored and gregkh committed Sep 8, 2024
1 parent 6590643 commit 26cdb5e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -4129,8 +4129,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);
Expand Down

0 comments on commit 26cdb5e

Please sign in to comment.