lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <884b009a-d3bf-4d7f-bcf7-ae50ee01c7a3@amd.com>
Date: Sun, 17 Aug 2025 18:03:34 -0600
From: Alex Hung <alex.hung@....com>
To: Liao Yuanhong <liaoyuanhong@...o.com>, Austin Zheng
 <austin.zheng@....com>, Jun Lei <jun.lei@....com>,
 Harry Wentland <harry.wentland@....com>, Leo Li <sunpeng.li@....com>,
 Rodrigo Siqueira <siqueira@...lia.com>,
 Alex Deucher <alexander.deucher@....com>,
 Christian König <christian.koenig@....com>,
 David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
 "open list:AMD DISPLAY CORE" <amd-gfx@...ts.freedesktop.org>,
 "open list:DRM DRIVERS" <dri-devel@...ts.freedesktop.org>,
 open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/amd/display: Use swap() to simplify code

Reviewed-by: Alex Hung <alex.hung@....com>

On 8/6/25 06:41, Liao Yuanhong wrote:
> Replace the original swapping logic with swap() to improve readability and
> remove temporary variables
> 
> Signed-off-by: Liao Yuanhong <liaoyuanhong@...o.com>
> ---
>   drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
> index 5f1b49a50049..4cfe64aa8492 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
> @@ -473,7 +473,6 @@ static void sort_pipes_for_splitting(struct dc_plane_pipe_pool *pipes)
>   {
>   	bool sorted, swapped;
>   	unsigned int cur_index;
> -	unsigned int temp;
>   	int odm_slice_index;
>   
>   	for (odm_slice_index = 0; odm_slice_index < pipes->num_pipes_assigned_to_plane_for_odm_combine; odm_slice_index++) {
> @@ -489,9 +488,8 @@ static void sort_pipes_for_splitting(struct dc_plane_pipe_pool *pipes)
>   		swapped = false;
>   		while (!sorted) {
>   			if (pipes->pipes_assigned_to_plane[odm_slice_index][cur_index] > pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1]) {
> -				temp = pipes->pipes_assigned_to_plane[odm_slice_index][cur_index];
> -				pipes->pipes_assigned_to_plane[odm_slice_index][cur_index] = pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1];
> -				pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1] = temp;
> +				swap(pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1],
> +					 pipes->pipes_assigned_to_plane[odm_slice_index][cur_index]);
>   
>   				swapped = true;
>   			}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ